mindspore.Tensor.bitwise_and

Tensor.bitwise_and(x)[source]

Returns bitwise and of two tensors element-wise.

Refer to mindspore.ops.bitwise_and() for more detail.

Parameters

x (Tensor) – The input tensor with int16, int32 or uint16 data type.

Returns

Tensor, has the same type as the x.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import Tensor
>>> import numpy as np
>>> a = Tensor(np.array([0, 0, 1, -1, 1, 1, 1]), mindspore.int16)
>>> b = Tensor(np.array([0, 1, 1, -1, -1, 2, 3]), mindspore.int16)
>>> output = a.bitwise_and(b)
>>> print(output)
[ 0  0  1 -1  1  0  1]