[Relay] Add printing for ADT Type (#3030)
author雾雨魔理沙 <lolisa@marisa.moe>
Wed, 17 Apr 2019 20:16:37 +0000 (13:16 -0700)
committerHaichen Shen <shenhaichen@gmail.com>
Wed, 17 Apr 2019 20:16:37 +0000 (13:16 -0700)
* Update pretty_printer.cc

* Update pretty_printer.cc

src/relay/ir/pretty_printer.cc

index f4a830040f707ceaf6a83834decd7eb3f2186ecd..71502614abd64b4f2e70b0b9275211c13261f35c 100644 (file)
@@ -592,6 +592,22 @@ class PrettyPrinter :
     return AllocTypeVar(GetRef<TypeVar>(node));
   }
 
+  Doc VisitType_(const GlobalTypeVarNode* node) final {
+    return Doc(node->var->name_hint);
+  }
+
+  Doc VisitType_(const TypeCallNode* node) final {
+    Doc doc = PrintType(node->func, false);
+    std::vector<Doc> args;
+    for (const Type& t : node->args) {
+      args.push_back(PrintType(t, false));
+    }
+    doc << "[";
+    doc << PrintVec(args);
+    doc << "]";
+    return doc;
+  }
+
   Doc VisitType_(const TensorTypeNode* node) final {
     // scalar type
     if (node->shape.size() == 0) {