mindspore.mint.logical_xor

mindspore.mint.logical_xor(input, other)[源代码]

逐元素计算两个tensor的逻辑异或运算。

outi=inputiotheri

说明

  • 支持广播。

  • 支持隐式类型转换。

参数:
  • input (Tensor) - 第一个输入tensor。

  • other (Tensor) - 第二个输入tensor。

返回:

Tensor

支持平台:

Ascend

样例:

>>> import mindspore
>>> x = mindspore.tensor([True, False, True], mindspore.bool_)
>>> y = mindspore.tensor([True, True, False], mindspore.bool_)
>>> output = mindspore.mint.logical_xor(x, y)
>>> print(output)
[False  True  True]
>>> x = mindspore.tensor(1, mindspore.bool_)
>>> y = mindspore.tensor(0, mindspore.bool_)
>>> output = mindspore.mint.logical_xor(x, y)
>>> print(output)
True
>>> x = True
>>> y = mindspore.tensor(0, mindspore.bool_)
>>> output = mindspore.mint.logical_xor(x, y)
>>> print(output)
True
>>> x = True
>>> y = mindspore.tensor([True, False], mindspore.bool_)
>>> output = mindspore.mint.logical_xor(x, y)
>>> print(output)
[False  True]