Skip to content
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

Merged
merged 2 commits into from
Feb 22, 2019
Merged

[Relay] GNF #2492

merged 2 commits into from
Feb 22, 2019

Conversation

MarisaKirisame
Copy link
Contributor

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.

@MarisaKirisame
Copy link
Contributor Author

@srkreddy1238 @vinx13 @yzhliu can you guys help review? Thx!

@slyubomirsky
Copy link
Contributor

If recursion is a corner case, can you have a recursive test case?

include/tvm/relay/pass.h Outdated Show resolved Hide resolved
@MarisaKirisame
Copy link
Contributor Author

@slyubomirsky recursion need pass manager. i will add it once it get in.

@slyubomirsky
Copy link
Contributor

What would the pass manager be needed to do?

@MarisaKirisame
Copy link
Contributor Author

pass manager will apply a pass into a golbalvar. somehow fuse_ops cant handle recursion without it.

src/relay/pass/to_gnf.cc Outdated Show resolved Hide resolved
src/relay/pass/to_gnf.cc Outdated Show resolved Hide resolved
src/relay/pass/to_gnf.cc Outdated Show resolved Hide resolved
from tvm.relay.backend.interpreter import Value, TupleValue


def check_eval(expr, args, expected_result, mod=None, rtol=1e-07):
Copy link
Member

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

Copy link
Member

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

Copy link
Contributor Author

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

tests/python/relay/test_to_gnf.py Outdated Show resolved Hide resolved
@tqchen
Copy link
Member

tqchen commented Feb 12, 2019

Followup comment: to make API consistent, maybe we should rename to_anf to to_a_normal_form

@MarisaKirisame
Copy link
Contributor Author

@tqchen can you review? sorry for the inconvenience.

do

add

fix lint

address some comment

rename

save

fix

address comment

fix

fix

lint
@tqchen tqchen added status: accepted and removed status: need review status: need update need update based on feedbacks labels Feb 22, 2019
@tqchen tqchen merged commit c88bda5 into apache:master Feb 22, 2019
@yzhliu yzhliu mentioned this pull request Mar 2, 2019
28 tasks
wweic pushed a commit to neo-ai/tvm that referenced this pull request Mar 9, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Mar 12, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Mar 12, 2019
@MarisaKirisame MarisaKirisame deleted the gnf branch March 28, 2019 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants