Hi Everyone
I am looking for a way to print the Relay IR of a module within C++ in SSA format.
i.e., I am looking for the C++ equivalent to Python’s astext()
I found it: RelayPrint()
in \src\relay\ir\pretty_printer.cc
1 Like
Hi Mostafaelhoushi,
I have the same problem. And i see the function AsText() in pretty_printer.cc, but i still has one issue to print it. Can you help ?
#0 tvm::relay::backend::RelayBuildModule::Optimize (this=0x2ad2750, relay_module=…, targets=…, params=std::unordered_map with 102 elements = {…})
at /home/shangqiu/tvm/tvm/src/relay/backend/build_module.cc:314
(gdb) print relay_module
$3 = {tvm::NodeRef = {node_ = {data_ = 0x126b1f8}}, }
(gdb) print AsText((relay_module), false, null)
Invalid cast.
(gdb) call AsText((relay_module), false, null)
Invalid cast.
Thank you in advance
This issue can be solved by adding private function privateAsText :
void privateAsText (tvm::NodeRef node);
void privateAsText (tvm::NodeRef node ) {
std::string text= PrettyPrint_(node, false, NULL);
LOG(INFO) "Dump of group info:\n"<<text;
}