From 0565fcc8d3efc05cc67213260818f6a7da300caa Mon Sep 17 00:00:00 2001 From: Yang Chen <40417152+yangchen-MS@users.noreply.github.com> Date: Tue, 11 Sep 2018 14:31:33 -0700 Subject: [PATCH] Added a helper function that dumps Node to stderr (#1703) --- include/tvm/expr.h | 7 +++++++ src/lang/expr.cc | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/include/tvm/expr.h b/include/tvm/expr.h index 64a112d05..fe645bcf5 100644 --- a/include/tvm/expr.h +++ b/include/tvm/expr.h @@ -230,6 +230,13 @@ using Domain = Array<Range>; // print functions for expr TVM_DLL std::ostream& operator<<(std::ostream& os, const NodeRef& n); // NOLINT(*) + +/*! + * \brief Dump the node to stderr, used for debug purposes. + * \param node The input node + */ +TVM_DLL void Dump(const NodeRef& node); + // definition of Node. /*! * \brief An iteration variable representing an iteration diff --git a/src/lang/expr.cc b/src/lang/expr.cc index 684211079..c2dab10c2 100644 --- a/src/lang/expr.cc +++ b/src/lang/expr.cc @@ -47,6 +47,10 @@ std::ostream& operator<<(std::ostream& os, const NodeRef& n) { // NOLINT(*) return os; } +void Dump(const NodeRef& n) { + std::cerr << n << "\n"; +} + Var var(const std::string& name_hint, Type t) { return Var(name_hint, t); } -- GitLab