Hi @mbrookhart,
I have made some attempts as you suggested (doing reverse topological order and getting the part after IF as you suggested). Here is my understanding of your suggestions which I also agree with. Please let me know if I got them wrong. Here are the steps that I assumed that I should follow to extract the parts after IF:
- To reverse traversal by reverse top sort
- when I hit IF, I know that I traversed the parts that I need to extract.
I was not able to traverse the relay expressions in reverse order. Could you please elaborate on this?
I have tried to use ExprMutator and relay.analysis.post_order_visit to do reverse topological order sort.