asc2.right_shift

asc2.right_shift(input: LocalTensor, other: PlainValue | int) LocalTensor

Computes the element-wise right shift (bitwise) of input and other.

The supported data types for the inputs are: int16, int32, int64.

Parameters:
  • input – The left operand (tensor or scalar)

  • other – The right operand (scalar)

Returns:

The result of right shift (bitwise)

Return type:

LocalTensor

Raises:

RuntimeError – If neither operand is a LocalTensor

Note

At least one of input operands must be LocalTensor. Operands are automatically cast to a common data type and broadcast to a common shape. When one operand is a LocalTensor and the other is a scalar, the tensor’s dtype takes precedence. Inputs must either have the same shapes or be broadcastable according to NumPy broadcasting rules.

Examples

Compute the right shift (bitwise) of tensor elements and a given scalar value:

input = asc2.copy_in(tensor, [0, 0], [32, 16])
result = asc2.right_shift(input, 2)

This function can also be called via a binary operator on LocalTensor, as input >> other instead of right_shift(input, other).