Commit 552d4aa3 by Jared Roesch Committed by Tianqi Chen

[Relay][RFC][Fix] Rename RelayPrint to AsText (#2984)

parent cffb4fba
......@@ -562,14 +562,14 @@ inline const TTypeNode* ExprNode::type_as() const {
}
/*!
* \brief Print node as text format.
* \param node The node to be printed.
* \brief Render the node as a string in the Relay text format.
* \param node The node to be rendered.
* \param show_meta_data Whether to print meta data section.
* \param annotate An optional callback function for attaching
* additional comment block to an expr.
* \return The text representation.
*/
std::string RelayPrint(const NodeRef& node,
std::string AsText(const NodeRef& node,
bool show_meta_data = true,
runtime::TypedPackedFunc<std::string(Expr)> annotate = nullptr);
} // namespace relay
......
......@@ -78,7 +78,7 @@ class RelayNode(NodeBase):
text : str
The text format of the expression.
"""
return _expr.RelayPrint(self, show_meta_data, annotate)
return _expr.AsText(self, show_meta_data, annotate)
def set_span(self, span):
_base.set_span(self, span)
......
......@@ -110,7 +110,7 @@ void ErrorReporter::RenderErrors(const Module& module, bool use_color) {
//
// The annotation callback will annotate the error messages
// contained in the map.
annotated_prog << RelayPrint(func, false, [&err_map](tvm::relay::Expr expr) {
annotated_prog << AsText(func, false, [&err_map](tvm::relay::Expr expr) {
auto it = err_map.find(expr);
if (it != err_map.end()) {
return it->second;
......
......@@ -709,7 +709,7 @@ std::string PrettyPrint_(const NodeRef& node,
return doc.str();
}
std::string RelayPrint(const NodeRef& node,
std::string AsText(const NodeRef& node,
bool show_meta_data,
runtime::TypedPackedFunc<std::string(Expr)> annotate) {
return PrettyPrint_(node, show_meta_data, annotate, true);
......@@ -722,10 +722,10 @@ std::string PassDebugPrint(const NodeRef& node,
return PrettyPrint_(node, show_meta_data, annotate, gnf);
}
TVM_REGISTER_API("relay._expr.RelayPrint")
TVM_REGISTER_API("relay._expr.AsText")
.set_body_typed<std::string(const NodeRef&,
bool,
runtime::TypedPackedFunc<std::string(Expr)>)>(RelayPrint);
runtime::TypedPackedFunc<std::string(Expr)>)>(AsText);
TVM_REGISTER_API("relay._ir_pass.pass_debug_print")
.set_body_typed<std::string(const NodeRef&,
......
......@@ -890,7 +890,7 @@ class FuseMutator : private ExprMutator {
// Debug function, dump the group assignment in text.
void DebugDumpGroup(const Expr& body) {
std::string text = RelayPrint(body, false, [this](const Expr& expr) -> std::string {
std::string text = AsText(body, false, [this](const Expr& expr) -> std::string {
auto it = gmap_.find(expr.get());
if (it == gmap_.end()) return "";
std::ostringstream os;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment