simple functorch with modes#40
Draft
samdow wants to merge 1 commit into
Draft
Conversation
samdow
commented
Jun 14, 2022
|
|
||
| from torch.utils._mode_utils import no_dispatch | ||
|
|
||
| class Autograd(Dispatcher): |
Collaborator
Author
There was a problem hiding this comment.
Note that because we're sitting at the torch dispatch level, autograd has already happened so we still have to rewrite autograd here and can't reuse PyTorch's autograd. This would be a no-go in actual functorch so we'll need to figure out a solution here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a rewrite of the simple functorch notebook to use torch dispatch modes. In doing this, we needed to add padding to vmap (i.e. we need to make
vmap(f)(torch.randn(2), torch.randn(2, 4))work)Still TODO:
It raised a couple bugs in torch dispatch modes
enable_torch_dispatch_mode(None, replace=True)work