You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by david via TVM Discuss <no...@discuss.tvm.ai> on 2020/05/19 05:49:32 UTC

[TVM Discuss] [Questions] Traversing Relay Graph order (source to sink, sink to source)


Dear All,

I am new to TVM. and I am wondering what facilities does TVM/Relay support to traverse the network graph?

Assuming I have a DAG, can I traverse from the sink to the source?  and vise versa? 

Thanks.
D.





---
[Visit Topic](https://discuss.tvm.ai/t/traversing-relay-graph-order-source-to-sink-sink-to-source/6720/1) 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/40d5712578547fec5103c012fe01d6093b135d8484151764593256cab6fd7b84).

[TVM Discuss] [Questions] Traversing Relay Graph order (source to sink, sink to source)

Posted by Steve via TVM Discuss <no...@discuss.tvm.ai>.

@comaniac - are you assuming that user needs to extend from the ExprMutator class? 

I have been mostly user of TVM, and now, I'd like to spend some time to understand relay. 

How does this method differs from the post_order_visit function provided by TVM? 
 
[quote="comaniac, post:3, topic:6720"]
```
def visit(self, node):
   super().visit(node)
   // do something
```

Preorder. In this case the first node that processes “do something” would be the last node in a DAG.

```
def visit(self, node):
   // do something
   super().visit(node)
```
[/quote]





---
[Visit Topic](https://discuss.tvm.ai/t/traversing-relay-graph-order-source-to-sink-sink-to-source/6720/4) 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/5878acc50f3064066de0f5b06b16b39fa7270942a529dc3d1a6613fd02b6cc67).

[TVM Discuss] [Questions] Traversing Relay Graph order (source to sink, sink to source)

Posted by "Cody H. Yu via TVM Discuss" <no...@discuss.tvm.ai>.

Both orders can be implemented using post_order_visit.

Postorder. In this case the first node that processes "do something" would be the source node in a DAG.

```python
def visit(self, node):
   super().visit(node)
   // do something
```

Preorder. In this case the first node that processes "do something" would be the last node in a DAG.

```python
def visit(self, node):
   // do something
   super().visit(node)
```





---
[Visit Topic](https://discuss.tvm.ai/t/traversing-relay-graph-order-source-to-sink-sink-to-source/6720/3) 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/21fe69fe4d7cebb25bc02d6120816e3ba91190549c7f718e56743e87af624a7d).

[TVM Discuss] [Questions] Traversing Relay Graph order (source to sink, sink to source)

Posted by david via TVM Discuss <no...@discuss.tvm.ai>.

Hi All,

I was able to traverse the graph using [ `post_order_visit` ](https://docs.tvm.ai/api/python/relay/analysis.html#tvm.relay.analysis.post_order_visit)(expr, fvisit) 

However, this function starts from the source of DAG. I want to traverse the DAG from the reverse order. Is there  a way to do it for the relay expressions?





---
[Visit Topic](https://discuss.tvm.ai/t/traversing-relay-graph-order-source-to-sink-sink-to-source/6720/2) 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/2672afe90071f6b6ba4e2e26fef677738f1869a3412777f48595ddf4d7c9178f).