8000 Fix allow_mutation_on_saved_tensors for inplace foreach by soulitzer · Pull Request #145520 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

Fix allow_mutation_on_saved_tensors for inplace foreach #145520

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

Closed
wants to merge 6 commits into from

Conversation

soulitzer
Copy link
Contributor
@soulitzer soulitzer commented Jan 23, 2025

Copy link
pytorch-bot bot commented Jan 23, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/145520

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit d8db1d6 with merge base e57cdb8 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

soulitzer added a commit that referenced this pull request Jan 23, 2025
# The same exact tensor has been cloned already
continue
ctx.cloned[handle] = ctx.original[handle].clone()
del ctx.original[handle]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unchanged - factored out to a function

soulitzer added a commit that referenced this pull request Jan 23, 2025
@soulitzer soulitzer added release notes: autograd release notes category topic: bug fixes topic category labels Jan 23, 2025
@pytorch pytorch deleted a comment from github-actions bot Jan 23, 2025
Copy link
Collaborator
@albanD albanD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

del ctx.original[handle]
if arg.is_out:
maybe_clone(kwargs["out"])
elif isinstance(args[idx], list):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are arguments always normalized as lists here? Or they could be any sequence?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so - we rely the jit logic to convert ivalues to PyObjects which should always map ivalue list types to py::list.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

pytorchmergebot pushed a commit that referenced this pull request Jan 25, 2025
pytorchmergebot pushed a commit that referenced this pull request Jan 25, 2025
Fixes #93045 #93044

From previous discussion #93045 (comment) the resolution is that we're okay with removing this.

Some older attempts:
- #102581
- #109249

Pull Request resolved: #145533
Approved by: https://github.com/lezcano, https://github.com/malfet
ghstack dependencies: #145520, #145531
pytorchmergebot pushed a commit that referenced this pull request Jan 25, 2025
nWEIdia pushed a commit to nWEIdia/pytorch that referenced this pull request Jan 27, 2025
nWEIdia pushed a commit to nWEIdia/pytorch that referenced this pull request Jan 27, 2025
nWEIdia pushed a commit to nWEIdia/pytorch that referenced this pull request Jan 27, 2025
Fixes pytorch#93045 pytorch#93044

From previous discussion pytorch#93045 (comment) the resolution is that we're okay with removing this.

Some older attempts:
- pytorch#102581
- pytorch#109249

Pull Request resolved: pytorch#145533
Approved by: https://github.com/lezcano, https://github.com/malfet
ghstack dependencies: pytorch#145520, pytorch#145531
nWEIdia pushed a commit to nWEIdia/pytorch that referenced this pull request Jan 27, 2025
@github-actions github-actions bot deleted the gh/soulitzer/344/head branch February 24, 2025 02:07
desai0007 pushed a commit to desai0007/test-repo-pytorch that referenced this pull request Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Merged release notes: autograd release notes category topic: bug fixes topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0