tvm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-tvm] tqchen commented on a change in pull request #5523: [Refactor][std::string --> String] IRModule is updated with String
Date Wed, 06 May 2020 19:21:48 GMT

tqchen commented on a change in pull request #5523:
URL: https://github.com/apache/incubator-tvm/pull/5523#discussion_r421034694



##########
File path: src/printer/relay_text_printer.cc
##########
@@ -918,13 +918,29 @@ static const char* kSemVer = "v0.0.4";
 //    - Implements AsText
 // - relay_text_printer.cc (specific printing logics for relay)
 // - tir_text_printer.cc (specific printing logics for TIR)
-std::string PrettyPrint(const ObjectRef& node) {
+String PrettyPrint(const ObjectRef& node) {
   Doc doc;
   doc << relay::RelayTextPrinter(false, nullptr).PrintFinal(node);
   return doc.str();
 }
 
-std::string AsText(const ObjectRef& node,
+String AsText(const ObjectRef& node,
+                   bool show_meta_data,
+                   runtime::TypedPackedFunc<String(ObjectRef)> annotate) {
+  Doc doc;
+  doc << kSemVer << Doc::NewLine();
+  runtime::TypedPackedFunc<std::string(ObjectRef)> ftyped = nullptr;
+  if (annotate != nullptr) {
+    ftyped = runtime::TypedPackedFunc<std::string(ObjectRef)>(
+      [&annotate](const ObjectRef& expr) -> std::string {
+        return annotate(expr);
+      });
+  }
+  doc << relay::RelayTextPrinter(show_meta_data, ftyped).PrintFinal(node);
+  return doc.str();
+}
+
+String AsTextByStr(const ObjectRef& node,

Review comment:
       We don't want to introduce two variants of the functions (std::string and String).





----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message