mindspore.ops.bitwise_right_shift

mindspore.ops.bitwise_right_shift(input, other)[source]

Perform a right bitwise shift operation on the input element-wise, where the number of bits to shift is specified by other.

\[\begin{aligned} &out_{i} =input_{i} >> other_{i} \end{aligned}\]
Parameters
  • input (Union[Tensor, int, bool]) – The input to be right shifted.

  • other (Union[Tensor, int, bool]) – The number of bit to be applied on right arithmetic shift.

Returns

Tensor, the result after bitwise right shift.

Raises
  • TypeError – If neither input nor other is a tensor.

  • TypeError – If either input or other is not a bool, int or a tensor of dtype: int or uint.

  • TypeError – If input and other do not have the same dtype.

  • ValueError – If input and other could not be broadcast.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> input = Tensor(np.array([1024, 2]), mindspore.int16)
>>> other = Tensor(np.array([2]), mindspore.int16)
>>> output = ops.bitwise_right_shift(input, other)
>>> print(output)
[256   0]