From c66a3ff7a03014df86b83cb071ded923d6d45493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=BE=E9=9B=A8=E9=AD=94=E7=90=86=E6=B2=99?= Date: Wed, 17 Apr 2019 13:16:37 -0700 Subject: [PATCH] [Relay] Add printing for ADT Type (#3030) * Update pretty_printer.cc * Update pretty_printer.cc --- src/relay/ir/pretty_printer.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/relay/ir/pretty_printer.cc b/src/relay/ir/pretty_printer.cc index f4a830040f70..71502614abd6 100644 --- a/src/relay/ir/pretty_printer.cc +++ b/src/relay/ir/pretty_printer.cc @@ -592,6 +592,22 @@ class PrettyPrinter : return AllocTypeVar(GetRef(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 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) {