-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[C10] Add Scalar::isUnsigned() method
#159877
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/159877
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ You can merge normally! (3 Unrelated Failures)As of commit ffc6fea with merge base 510e8b4 ( UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| // See Note [Meaning of HAS_u] | ||
| bool isUnsigned() const { | ||
| return Tag::HAS_u == tag || (Tag::HAS_i == tag && v.i >= 0); | ||
| } |
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.
Yes this is fine. But you might want an alternative that tells you if it fits in 64-bit int or not, since that's what you are probably actually interested in when you do the IValue.
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.
That's kind of my debate: should I create some sort of semantically weird is64bitUnsigned API here, or check it on the caller side. I'm leaning towards later...
|
@pytorchbot merge -f "This seems fine" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
That returns true if Scalar hold unsigned integral value With the implications of `Tag::HAS_u` semantic. Pull Request resolved: pytorch#159877 Approved by: https://github.com/Skylion007, https://github.com/ezyang
Stack from ghstack (oldest at bottom):
Scalar::isUnsigned()method #159877That returns true if Scalar hold unsigned integral value
With the implications of
Tag::HAS_usemantic.