Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IR][Debug] Add dump and print for debugging (NFC) #5207

Merged
merged 1 commit into from
Apr 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion include/tvm/node/repr_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ class ReprPrinter {
* \brief Dump the node to stderr, used for debug purposes.
* \param node The input node
*/
TVM_DLL void Dump(const ObjectRef& node);
TVM_DLL void Dump(const runtime::ObjectRef& node);

/*!
* \brief Dump the node to stderr, used for debug purposes.
* \param node The input node
*/
TVM_DLL void Dump(const runtime::Object* node);

} // namespace tvm

Expand Down
6 changes: 5 additions & 1 deletion src/node/repr_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ ReprPrinter::FType& ReprPrinter::vtable() {
return inst;
}

void Dump(const ObjectRef& n) {
void Dump(const runtime::ObjectRef& n) {
std::cerr << n << "\n";
}

void Dump(const runtime::Object* n) {
Dump(runtime::GetRef<runtime::ObjectRef>(n));
}

TVM_REGISTER_GLOBAL("node.AsRepr")
.set_body_typed([](runtime::ObjectRef obj) {
std::ostringstream os;
Expand Down