-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Support __rlshift__
and __rrshift__
#58121
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
Comments
Thanks @asi1024. I think we would accept PRs for each of these functions. |
@mruberry I'm planning to support also function interface, but NumPy has a different interface from what Python array API specifies. Which policy of interface should we follow? Or should we support both interfaces? Python Array API: bitwise_left_shift |
Hey @asi1024! Great question. We want to implement the Python Array API, but it's OK to have extra keyword arguments, like an out= parameter, that make the function more consistent with other PyTorch functions. |
My concern is about the difference in function names. NumPy supports |
Let's ask @rgommers if the difference is intentional. In Python it's also "left shift," so I'm a little surprised the Python Array API differs from it. Maybe an oversight? We can also alias |
Yes, this is on purpose, see comments in: data-apis/array-api#54. NumPy was a bit inconsistent here, prepending |
Note that PyTorch already has some shift functionality:
but it doesn't appear to be documented. |
🚀 Feature
Support
torch.Tensor.{__rlshift__, __rrshift__}
.(cc: @mruberry, @rgommers, @emcastillo and @kmaehashi)
Motivation and Pitch
To enhance the compatibility with NumPy’s interface (c.f. #38349).
References
The text was updated successfully, but these errors were encountered: