junrushao1994 commented on code in PR #12048:
URL: https://github.com/apache/tvm/pull/12048#discussion_r922704027
##########
src/script/printer/python_doc_printer.cc:
##########
@@ -57,6 +82,179 @@ void PythonDocPrinter::PrintTypedDoc(const LiteralDoc& doc)
{
}
}
+void PythonDocPrinter::PrintTypedDoc(const IdDoc& doc) { output_ << doc->name;
}
+
+void PythonDocPrinter::PrintTypedDoc(const AttrAccessDoc& doc) {
+ PrintDoc(doc->value);
+ output_ << "." << doc->attr;
+}
+
+void PythonDocPrinter::PrintTypedDoc(const IndexDoc& doc) {
+ PrintDoc(doc->value);
+ if (doc->indices.size() == 0) {
+ output_ << "[()]";
+ } else {
+ output_ << "[";
+ PrintJoinedDocs(doc->indices, ", ");
+ output_ << "]";
+ }
+}
+
+const std::string OperatorToString(OperationDocNode::Kind operation_kind) {
+ static const std::vector<std::string> OP_STR_TABLE = []() {
Review Comment:
nit: no need to case this table given it's just a local variable (it's just
personal preference)
```suggestion
static const std::vector<std::string> op_kind2str = []() {
```
##########
src/script/printer/python_doc_printer.cc:
##########
@@ -57,6 +82,179 @@ void PythonDocPrinter::PrintTypedDoc(const LiteralDoc& doc)
{
}
}
+void PythonDocPrinter::PrintTypedDoc(const IdDoc& doc) { output_ << doc->name;
}
+
+void PythonDocPrinter::PrintTypedDoc(const AttrAccessDoc& doc) {
+ PrintDoc(doc->value);
+ output_ << "." << doc->attr;
+}
+
+void PythonDocPrinter::PrintTypedDoc(const IndexDoc& doc) {
+ PrintDoc(doc->value);
+ if (doc->indices.size() == 0) {
+ output_ << "[()]";
+ } else {
+ output_ << "[";
+ PrintJoinedDocs(doc->indices, ", ");
+ output_ << "]";
+ }
+}
+
+const std::string OperatorToString(OperationDocNode::Kind operation_kind) {
+ static const std::vector<std::string> OP_STR_TABLE = []() {
Review Comment:
nit: no need to case this table given it's just a local variable (it's just
personal preference though)
```suggestion
static const std::vector<std::string> op_kind2str = []() {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]