bitwise_and

paddle. bitwise_and ( x, y, out=None, name=None ) [source]

Apply bitwise_and on Tensor X and Y .

\[Out = X \& Y\]

Note

paddle.bitwise_and supports broadcasting. If you want know more about broadcasting, please refer to please refer to Introduction to Tensor .

Parameters
  • x (Tensor) – Input Tensor of bitwise_and . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.

  • y (Tensor) – Input Tensor of bitwise_and . It is a N-D Tensor of bool, uint8, int8, int16, int32, int64.

  • out (Tensor, optional) – Result of bitwise_and . It is a N-D Tensor with the same data type of input Tensor. Default: None.

  • name (str, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name.

Returns

Result of bitwise_and . It is a N-D Tensor with the same data type of input Tensor.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.to_tensor([-5, -1, 1])
>>> y = paddle.to_tensor([4,  2, -3])
>>> res = paddle.bitwise_and(x, y)
>>> print(res)
Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
[0, 2, 1])