-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Turn internal assert when saved tensor is detached inplace into torch check #88860
Conversation
… check [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/88860
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 FailuresAs of commit b9b4eff: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
… check ghstack-source-id: ea2a4d8c7236343c326a1ac33c005fc650a4be41 Pull Request resolved: #88860
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.
SGTM
// input or output. | ||
TORCH_CHECK( | ||
saved_for, | ||
"Trying to use a saved tensor that has been detached in-place, i.e. with .detach_()." |
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.
btw is inplace detach() bumping the version counter? If so, then the vc check below would also fail. Not sure which of the two error is best...
I would vote for to keep the more precise one here about inplace detach but I'm open.
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.
From looking at its kernel in VariableTypeManual, it doesn't redispatch to ADInplaceOrView, so we should be good.
>>> import torch
>>> a = torch.tensor(1., requires_grad=True)
>>> a._version
0
>>> a.detach_()
tensor(1.)
>>> a._version
0
>>> a.add_(1)
tensor(2.)
>>> a._version
1
>>>
… into torch check" Fixes #88809 [ghstack-poisoned]
@pytorchbot merge -g |
Merge startedYour change will be merged once all checks on your PR pass since you used the green (-g) flag (ETA: 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: The following mandatory check(s) failed (Rule Dig deeper by viewing the failures on hud Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge -f "Unrelated failures" |
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 |
… check (pytorch#88860) Fixes pytorch#88809 Pull Request resolved: pytorch#88860 Approved by: https://github.com/albanD
Stack from ghstack (oldest at bottom):
Fixes #88809