-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Move private forward grad mode helpers to torch.autograd.forward_ad #90240
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
Conversation
Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/90240
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 FailuresAs of commit fb114c3: The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
torch/autograd/forward_ad.py
Outdated
| # Private helper function to enable or disable fwd grad. | ||
| # If you're a user and want to use this, please file an issue to discuss the use case. | ||
| @contextlib.contextmanager | ||
| def _enable_fwd_grad(enabled=True): |
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.
Maybe we should be consistent with the API for backward AD. This function looks like it is analogous to _set_grad_enabled, so we should name it _set_fwd_grad_enabled and don't have a default value. (If it were analogous to enable_grad, it shouldn't take any arguments and always sets it to True.)
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.
Sure
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
…orward_ad" Motivation - These were previously defined in functorch. They are not functorch-specific, so I'm moving them to torch.autograd.forward_ad and the autograd python bindings. - I need this to avoid some of my cyclic import problems. Should these be public APIs? Probably. Though this needs discussion, so punting it to the future. Test Plan: - moved the tests of these from test/functorch/test_eager_transforms.py to test/test_autograd.py [ghstack-poisoned]
|
@pytorchbot merge -f "test failures look unrelated" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
Comments like pytorch/torch/csrc/autograd/autograd_meta.cpp Line 275 in 5c133c5
|
Addresses #90240 (comment) This was the only comment I found after grepping the codebase, but please let me know if I missed others. Test Plan: - code reading [ghstack-poisoned]
Addresses #90240 (comment) This was the only comment I found after grepping the codebase, but please let me know if I missed others. Test Plan: - code reading ghstack-source-id: 7d94a9d Pull Request resolved: #90790
…being used in custom Function" Addresses #90240 (comment) This was the only comment I found after grepping the codebase, but please let me know if I missed others. Test Plan: - code reading [ghstack-poisoned]
…stom Function" Addresses #90240 (comment) This was the only comment I found after grepping the codebase, but please let me know if I missed others. Test Plan: - code reading [ghstack-poisoned]
…on (#90790) Addresses #90240 (comment) This was the only comment I found after grepping the codebase, but please let me know if I missed others. Test Plan: - code reading Pull Request resolved: #90790 Approved by: https://github.com/soulitzer
Stack from ghstack:
Motivation
functorch-specific, so I'm moving them to torch.autograd.forward_ad and
the autograd python bindings.
Should these be public APIs? Probably. Though this needs discussion, so
punting it to the future.
Test Plan:
to test/test_autograd.py