Skip to content

Commit

Permalink
Merge pull request apache#1 from microsoft/kedeng/dbg
Browse files Browse the repository at this point in the history
Add debug print for Visual Studio immediate window.
  • Loading branch information
KeDengMS authored Jun 28, 2019
2 parents fd48016 + 69cbb52 commit b625640
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/tvm/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ TVM_DLL std::ostream& operator<<(std::ostream& os, const NodeRef& n); // NOLINT
*/
TVM_DLL void Dump(const NodeRef& node);

/*!
* \brief Dump the node to char[], used for debug purposes.
* \param node The input node
*/
TVM_DLL std::unique_ptr<char[]> ToString(const NodeRef& node);

// definition of Node.
/*!
* \brief An iteration variable representing an iteration
Expand Down
8 changes: 8 additions & 0 deletions src/lang/expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ void Dump(const NodeRef& n) {
std::cerr << n << "\n";
}

std::unique_ptr<char[]> ToString(const NodeRef& n) {
std::ostringstream s;
s << n << "\n";
std::unique_ptr<char[]> cc(new char[s.str().length() + 1]);
strcpy(cc.get(), s.str().c_str());
return cc;
}

Var var(const std::string& name_hint, Type t) {
return Var(name_hint, t);
}
Expand Down

0 comments on commit b625640

Please sign in to comment.