-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Fix memory leak on masked Tensor #137890
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
Fix memory leak on masked Tensor #137890
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/137890
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 41881d7 with merge base 0e4d426 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
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.
lgtm
Do our current tests catch that the unbreakable reference cycle is broken? |
It's pretty hard to detect that on the cpu side without flakyness :/ |
@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 mandatory check(s) failed. The first few are: Dig deeper by viewing the failures on hud |
@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 |
Note that this reverts the change from #137815 as well which is not needed anymore! Without this, you create an unbeakable reference cycle. It is unbreakable because part of the cycle is through the autograd graph which we cannot traverse. Pull Request resolved: #137890 Approved by: https://github.com/atalman, https://github.com/huydhn, https://github.com/Skylion007
2.5.1 is an emergency patch release to address specific large regressions, moving this to 2.6.0 |
For release 2.6 I verified that the change is present in https://github.com/pytorch/pytorch/blob/v2.6.0-rc9/torch/masked/maskedtensor/core.py and thus tested in CI. |
Note that this reverts the change from #137815 as well which is not needed anymore!
Without this, you create an unbeakable reference cycle. It is unbreakable because part of the cycle is through the autograd graph which we cannot traverse.