mindspore.ops.bitwise_and
- mindspore.ops.bitwise_and(input, other)[source]
Compute the bitwise AND of two input tensors. If input and other have different data types, the implicit type conversion rules and type promotion rules are followed.
- Parameters
- Returns
Tensor.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> input = mindspore.tensor([-1, -2, 3]) >>> other = mindspore.tensor([1, 0, 3]) >>> mindspore.ops.bitwise_and(input, other) Tensor(shape=[3], dtype=Int64, value= [1, 0, 3]) >>> # Same as calling via the | operator: >>> input & other Tensor(shape=[3], dtype=Int64, value= [1, 0, 3]) >>> # When inputs are boolean: >>> input = mindspore.tensor([True, True, False]) >>> other = mindspore.tensor([False, True, False]) >>> mindspore.ops.bitwise_and(input, other) Tensor(shape=[3], dtype=Bool, value= [False, True, False])