bitwise_right_shift

paddle. bitwise_right_shift ( x, y, is_arithmetic=True, out=None, name=None ) [source]

Apply bitwise_right_shift on Tensor X and Y .

\[Out = X \gg Y\]

Note

paddle.bitwise_right_shift supports broadcasting. If you want know more about broadcasting, please refer to please refer to Introduction to Tensor .

Parameters
  • x (Tensor) – Input Tensor of bitwise_right_shift . It is a N-D Tensor of uint8, int8, int16, int32, int64.

  • y (Tensor) – Input Tensor of bitwise_right_shift . It is a N-D Tensor of uint8, int8, int16, int32, int64.

  • is_arithmetic (bool, optional) – A boolean indicating whether to choose arithmetic shift, if False, means logic shift. Default True.

  • out (Tensor, optional) – Result of bitwise_right_shift . It is a N-D Tensor with the same data type of input Tensor. Default: None.

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

Result of bitwise_right_shift . It is a N-D Tensor with the same data type of input Tensor.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.to_tensor([[10,20,40,80],[16,17,32,65]])
>>> y = paddle.to_tensor([[1,2,3,4,], [2,3,2,1]])
>>> paddle.bitwise_right_shift(x, y, is_arithmetic=True)
Tensor(shape=[2, 4], dtype=int64, place=Place(gpu:0), stop_gradient=True,
       [[5 , 5 , 5 , 5 ],
        [4 , 2 , 8 , 32]])
>>> import paddle
>>> x = paddle.to_tensor([[-10,-20,-40,-80],[-16,-17,-32,-65]], dtype=paddle.int8)
>>> y = paddle.to_tensor([[1,2,3,4,], [2,3,2,1]], dtype=paddle.int8)
>>> paddle.bitwise_right_shift(x, y, is_arithmetic=False)  # logic shift
Tensor(shape=[2, 4], dtype=int8, place=Place(gpu:0), stop_gradient=True,
    [[123, 59 , 27 , 11 ],
        [60 , 29 , 56 , 95 ]])