Skip to content
fn

bitwise_left_shift_op

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

Python wrappers

Public Python APIs implemented by this engine symbol.

Element-wise left shift.

Computes out[i] = a[i] << b[i] for every element. Defined only on signed integer dtypes (I8/I16/I32/I64); Bool is rejected because shifting a bit has no defined meaning.

Non-differentiable: no autograd node is registered.

Math

out[i]=a[i]⋅2b[i]. \mathrm{out}[i] = a[i] \cdot 2^{b[i]}.

Out-of-range shift amounts follow the underlying C++ operator<< semantics for signed integers; callers should clamp b to [0, bitwidth) to stay portable.

References

NumPy numpy.left_shift.

See Also

bitwise_right_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.