-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Improve error message when view of intermediate is returned from autograd.Function and marked dirty #149543
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
…d.Function and marked dirty [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/149543
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (2 Unrelated Failures)As of commit 3455c3b with merge base e57cdb8 ( FLAKY - The following job failed but was likely due to flakiness present on trunk:
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
…d from autograd.Function and marked dirty" Fixes #149252 [ghstack-poisoned]
…d from autograd.Function and marked dirty" Fixes #149252 [ghstack-poisoned]
"Only input Tensors that have been mutated should be passed to " | ||
"ctx.mark_dirty()."; | ||
// We reach this path in the view of intermediate case | ||
TORCH_CHECK(!var.is_view(), mark_dirty_error_msg); |
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.
How does the intermediate case result in var being a view?
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.
a view of a intermediate tensor is still a view because we don't disable ADInplaceOrView
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.
What prevents an input from being a view?
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.
Inputs can be views and that is fine, we should do the usual rebase history stuff. If you mean to ask what happens if you are a view of the input, your view will be a leaf that require_grad being modified inplace and that is handled else-where (the previous branch of the if-else).
This PR is mainly targeting the case where the view was created from an intermediate, in which we are leaf with requires_grad=False and will immediately error (with an internal assert) because this autograd.Function is marked dirty and will call rebase_history on it.
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Merge failedReason: 1 jobs have failed, first few of them are: trunk / cuda12.1-py3.10-gcc9-sm80 / build Details for Dev Infra teamRaised by workflow job |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
…grad.Function and marked dirty (pytorch#149543) Fixes pytorch#149252 Pull Request resolved: pytorch#149543 Approved by: https://github.com/zou3519 ghstack dependencies: pytorch#149220
Stack from ghstack (oldest at bottom):
Fixes #149252