Skip to content
fn

bitwise_right_shift_op

→TensorImplPtr
int bitwise_right_shift_op(const int & a, const int & b)

Python wrappers

Public Python APIs implemented by this engine symbol.

Element-wise right shift.

Computes out[i] = a[i] >> b[i] for every element. Defined only on signed integer dtypes (I8/I16/I32/I64); Bool is rejected. On signed inputs the shift is arithmetic (sign-extending), matching the C++ operator>> convention used by the backend.

Non-differentiable: no autograd node is registered.

Math

out[i]=⌊a[i]/2b[i]⌋. \mathrm{out}[i] = \left\lfloor a[i] / 2^{b[i]} \right\rfloor.

For negative a[i] the result is the floor of the true division, i.e. the standard arithmetic-shift result.

References

NumPy numpy.right_shift.

See Also

bitwise_left_shift_op

Parameters

aTensorImplPtr
Value to shift. Signed integer dtype.
bTensorImplPtr
Shift amount per element. Must match a in shape, dtype, and device.

Returns

TensorImplPtr

Tensor of the same shape and dtype as the inputs.

Raises

LucidError
If shapes/devices differ, or if the input dtype is not one of I8/I16/I32/I64.

Notes

  • Floating-point and Bool inputs are rejected at the dispatch layer.
  • No broadcasting — shapes must match exactly.