Skip to content

Commit

Permalink
[Debug] Add Dump function for Object type (NFC) (#5207)
Browse files Browse the repository at this point in the history
Signed-off-by: Wei Pan <weip@nvidia.com>
  • Loading branch information
wpan11nv authored Apr 2, 2020
1 parent 5b857d3 commit 15b1751
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
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

0 comments on commit 15b1751

Please sign in to comment.