Thanks for the great proposal. @hcho3, I followed your [script in 
github](https://github.com/hcho3/relayviz) and noticed it missed a case when 
operator being "Call"ed is a function.  

Adding some code within "Call" condition can generate graph with each function 
singled out. 

```
            elif isinstance(node, tvm.relay.expr.Call):
                args = [node_dict[arg] for arg in node.args]
                if isinstance(node.op, tvm.relay.Function):
                    print(f'node_idx: {node_idx}, 
Call(Function({node_dict[node.op.body]}))')
                    dot.node(str(node_idx), 
f'Call(Function({node_dict[node.op.body]}))')
                else:
                    print(f'node_idx: {node_idx}, Call(op_name={node.op.name}, 
args={args})')
                    dot.node(str(node_idx), f'Call(op={node.op.name})')
                for arg in args:
                    dot.edge(str(arg), str(node_idx))
            elif isinstance(node, tvm.relay.Function):
                print(f'node_idx: {node_idx}, 
Function(body={node_dict[node.body]})')
                dot.node(str(node_idx), f'Function'+str({node_dict[node.body]}))
                dot.edge(str(node_dict[node.body]), str(node_idx))
```
![relay_graph|690x150](upload://dE1sridGzQo19Qm9tLjqkzRfc0l.png)





---
[Visit 
Topic](https://discuss.tvm.ai/t/rfc-visualizing-relay-program-as-graph/4825/15) 
to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.ai/email/unsubscribe/7bcc544c68d3e2a08eb015089fecb9db2bf1122c769665014c89432917f27519).

Reply via email to