Skip to content

lshift and rshift are supported for non-integral inputs and shifts #74358

@ngimel

Description

@ngimel

Pytorch quite nonsensically supports rshift/lshift on non-integral inputs and shifts:

In [13]: a=torch.randn(4)

In [14]: a.bitwise_right_shift(2) #there's nothing bitwise about this shift
Out[14]: tensor([-0.0470, -0.0847,  0.0964,  0.0141])

In [15]: a.bitwise_right_shift(1.5) #what does this even mean?
Out[15]: tensor([-0.0664, -0.1198,  0.1363,  0.0200])

numpy sensibly errors out in these cases

cc @ezyang
cc @mruberry @rgommers @nairbv

Metadata

Metadata

Assignees

No one assigned

    Labels

    module: numpyRelated to numpy support, and also numpy compatibility of our operatorsmodule: type promotionRelated to semantics of type promotiontriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions