mindspore.ops.bitwise_xor

View Source On Gitee
mindspore.ops.bitwise_xor(input, other)[source]

Compute the bitwise XOR of two input tensors. If input and other have different data types, the implicit type conversion rules and type promotion rules are followed.

Parameters
  • input (Tensor) – The first input tensor.

  • other (Tensor) – The second input tensor.

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_xor(input, other)
Tensor(shape=[3], dtype=Int64, value= [-2, -2,  0])
>>> # Same as calling via the ^ operator:
>>> input ^ other
Tensor(shape=[3], dtype=Int64, value= [-2, -2,  0])
>>> # When inputs are boolean:
>>> input = mindspore.tensor([True, True, False])
>>> other = mindspore.tensor([False, True, False])
>>> mindspore.ops.bitwise_xor(input, other)
Tensor(shape=[3], dtype=Bool, value= [ True, False, False])