-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Relay] GNF #2492
[Relay] GNF #2492
Conversation
@srkreddy1238 @vinx13 @yzhliu can you guys help review? Thx! |
If recursion is a corner case, can you have a recursive test case? |
@slyubomirsky recursion need pass manager. i will add it once it get in. |
What would the pass manager be needed to do? |
pass manager will apply a pass into a golbalvar. somehow fuse_ops cant handle recursion without it. |
tests/python/relay/test_to_gnf.py
Outdated
from tvm.relay.backend.interpreter import Value, TupleValue | ||
|
||
|
||
def check_eval(expr, args, expected_result, mod=None, rtol=1e-07): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write test cases that does ANF -> GNF roundtrip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get an existing neural network, run ToANF, and then ToGraphNormalForm and check consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to do an nn? i get a simpler test working
Followup comment: to make API consistent, maybe we should rename to_anf to to_a_normal_form |
@tqchen can you review? sorry for the inconvenience. |
This PR will do the exact reverse of ANF conversion - it take any code using let, and will attempt to remove the let by reusing the same expr.
The only nontrivial case is recursion - we keep let in such case to avoid forming loop.