From commits-return-13006-archive-asf-public=cust-asf.ponee.io@tvm.apache.org Wed May 6 19:21:50 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id B9CFA18064F for ; Wed, 6 May 2020 21:21:49 +0200 (CEST) Received: (qmail 46512 invoked by uid 500); 6 May 2020 19:21:49 -0000 Mailing-List: contact commits-help@tvm.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tvm.apache.org Delivered-To: mailing list commits@tvm.apache.org Received: (qmail 46503 invoked by uid 99); 6 May 2020 19:21:49 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 May 2020 19:21:49 +0000 From: =?utf-8?q?GitBox?= To: commits@tvm.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bincubator-tvm=5D_tqchen_commented_on_a_change_in_p?= =?utf-8?q?ull_request_=235523=3A_=5BRefactor=5D=5Bstd=3A=3Astring_--=3E_Str?= =?utf-8?q?ing=5D_IRModule_is_updated_with_String?= Message-ID: <158879290898.26397.2680874423006297836.asfpy@gitbox.apache.org> Date: Wed, 06 May 2020 19:21:48 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit References: In-Reply-To: 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 annotate) { + Doc doc; + doc << kSemVer << Doc::NewLine(); + runtime::TypedPackedFunc ftyped = nullptr; + if (annotate != nullptr) { + ftyped = runtime::TypedPackedFunc( + [&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