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][GRAD] Fix first-order AD on tuple arguments #6827

Merged
merged 1 commit into from
Nov 6, 2020

Conversation

altanh
Copy link
Contributor

@altanh altanh commented Nov 2, 2020

The first-order AD currently incorrectly deals with functions with tuple arguments, in particular by trying to add tuples when summing the gradients. Notably, this causes errors in the gradients of functions like stack which take a tuple of tensors. This PR lifts addition to work on the tuples (which was already done by the higher-order AD).

However, higher-order AD currently does not support tuples in the top-level function, and I added an xfail test to show this. I'm not sure how hard it is to change the higher-order code to support tuples at the top-level, so maybe someone else can take a look.

cc @MarisaKirisame @t-vi

}
return ll->Push(Tuple(updates));
} else {
LOG(FATAL) << "unsupported arg type of operator: " << t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try and do diagnostics here? we could put into improve AD with diagnostics

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on this but it will probably need some refactoring, we might as well do it for the whole pass (first-order and higher-order). I think a separate PR will be ideal.

@jroesch jroesch merged commit a6c29b2 into apache:main Nov 6, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants