Python wrappers
Public Python APIs implemented by this engine symbol.Element-wise bitwise AND.
Computes out[i] = a[i] & b[i] for every element. Defined on
integer (I8/I16/I32/I64) and Bool dtypes; on Bool
inputs the result is equivalent to logical AND.
Non-differentiable: bitwise operations have no meaningful gradient on integer manifolds, so no autograd node is registered.
Math
References
NumPy numpy.bitwise_and.
See Also
bitwise_or_op, bitwise_xor_op
Parameters
a, bTensorImplPtrOperands of identical shape, integer-or-Bool dtype, and device.
Returns
TensorImplPtrTensor of the same shape and dtype as the inputs.
Raises
LucidErrorIf shapes/devices differ, or if the input dtype is not integer or Bool.
Notes
- No broadcasting — shapes must match exactly.
- Floating-point inputs are rejected at the dispatch layer.
Examples
auto a = tensor({0b1100, 0b1010}, Dtype::I32);
auto b = tensor({0b1010, 0b0110}, Dtype::I32);
auto c = bitwise_and_op(a, b); // {0b1000, 0b0010}