-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Move torch/autograd/grad_mode.pyi stubs inline #43415
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
- Add torch._C bindings from torch/csrc/autograd/init.cpp - Renamed torch._C.set_grad_enabled to torch._C._set_grad_enabled so it doesn't conflict with torch.set_grad_enabled anymore Signed-off-by: Edward Z. Yang <ezyang@fb.com> (cherry picked from commit 551a222)
Note that this is most likely going to conflict with #41371 |
💊 CI failures summary and remediationsAs of commit 1ce96e3 (more details on the Dr. CI page):
Extra GitHub checks: 2 failed
codecov.io: 1 failed
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group. This comment has been revised 8 times. |
Thanks @albanD. From a quick look:
Conflict looks minor, happy to wait and make changes here as needed after gh-41371 lands. |
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.
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
I am waiting for a final review of my JIT-side changes on #41371 before I can land it. |
#41371 has landed. Feel free to rebase and merge. |
We can now rely on Literal from typing_extensions, but there's no good way of making the JIT understand a `Literal[False]` return value here (even when hiding the return type inside `if TYPE_CHECKING`). So don't revert commit b5cd3a8 after all.
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.
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
torch._C
bindings fromtorch/csrc/autograd/init.cpp
torch._C.set_grad_enabled
totorch._C._set_grad_enabled
so it doesn't conflict with torch.set_grad_enabled anymore
This is a continuation of gh-38201. All I did was resolve merge conflicts and finish the annotation of
_DecoratorContextManager.__call__
that @ezyang started in the first commit.Reverts commit b5cd3a8, which was only motivated by not having(JIT can't be made to understandtyping_extensions
available.Literal[False]
, so keep as is).