pymc.math.and_#
- pymc.math.and_ = Elemwise(scalar_op=AND,inplace_pattern=<frozendict {}>)[source]#
bitwise a & b
Computes element-wise bitwise AND operation between two tensors.
- Parameters:
- a
TensorLike
First input tensor
- b
TensorLike
Second input tensor
- a
- Returns:
TensorVariable
Output tensor with the bitwise AND of corresponding elements in a and b.
Notes
This function can also be used for logical AND operations on boolean tensors.
Examples
>>> import pytensor >>> import pytensor.tensor as pt >>> x = pt.vector("x", dtype="int32") >>> y = pt.vector("y", dtype="int32") >>> f = pytensor.function([x, y], pt.and_(x, y)) >>> f([1, 2, 3], [4, 2, 1]) array([0, 2, 1], dtype=int32)