mindspore.ops.logical_xor

mindspore.ops.logical_xor(input, other)[source]

Computes the “logical XOR” of two tensors element-wise.

\[out_{i} = x_{i} \oplus y_{i}\]
Parameters
  • input (Tensor) – The first input is a tensor whose data type can be implicitly converted to bool.

  • other (Tensor) – The second input is a tensor whose data type can be implicitly converted to bool to compute XOR with the first input.

Returns

Tensor, the shape is the same as the one after broadcasting, and the data type is bool.

Raises
  • TypeError – If neither input nor other is a Tensor whose data type is bool.

  • ValueError – If the shape of two inputs cannot be broadcast.

Supported Platforms:

Ascend CPU

Examples

>>> x = Tensor(np.array([True, False, True]), mindspore.bool_)
>>> y = Tensor(np.array([True, True, False]), mindspore.bool_)
>>> output = ops.logical_xor(x, y)
>>> print(output)
[False True True]