Skip to content

Avoid __ne__ weakref comparison and use identity instead in cache_size.py #135000

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 4 commits into from

Conversation

vmoens
Copy link
Contributor

@vmoens vmoens commented Sep 3, 2024

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Sep 3, 2024

🔗 Helpful Links

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

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

✅ You can merge normally! (1 Unrelated Failure)

As of commit 4f68a47 with merge base 8f5c2b5 (image):

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@vmoens
Copy link
Contributor Author

vmoens commented Sep 3, 2024

This change is needed because weakref.ref(obj) != weakref.ref(obj) falls back onto obj != obj which may not be a bool (eg if obj is a tensor).
For instance:

>>> obj = torch.randn((10,))
>>> ref1 = weakref.ref(obj)
>>> ref2 = weakref.ref(obj)
>>> print(ref1 == ref2)  # True
tensor([True, True, True, True, True, True, True, True, True, True])
>>> print(ref1 is ref2)  # False
True

Copy link
Contributor

@anijain2305 anijain2305 left a comment

Choose a reason for hiding this comment

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

Can you add a test please?

@vmoens
Copy link
Contributor Author

vmoens commented Sep 12, 2024

@anijain2305 I tried to find one simple test but couldn't so far. I'll let you know once I do

@vmoens
Copy link
Contributor Author

vmoens commented Sep 13, 2024

@pytorchmergebot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 13, 2024
@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: This PR needs a release notes: label
If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Details for Dev Infra team Raised by workflow job

Pavelanln pushed a commit to Pavelanln/Coppy that referenced this pull request Sep 18, 2024
@vmoens
Copy link
Contributor Author

vmoens commented Sep 30, 2024

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

[ghstack-poisoned]
vmoens added a commit that referenced this pull request Sep 30, 2024
[ghstack-poisoned]
vmoens added a commit that referenced this pull request Oct 1, 2024
[ghstack-poisoned]
vmoens added a commit that referenced this pull request Oct 1, 2024
@vmoens
Copy link
Contributor Author

vmoens commented Oct 3, 2024

@pytorchmergebot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your 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

Advanced Debugging
Check the merge workflow status
here

@github-actions github-actions bot deleted the gh/vmoens/1/head branch November 3, 2024 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants