mindspore.ops.logical_xor
- mindspore.ops.logical_xor(input, other)[源代码]
逐元素计算两个tensor的逻辑异或运算。
说明
支持广播。
支持隐式类型转换。
- 参数:
input (Tensor) - 第一个输入tensor。
other (Tensor) - 第二个输入tensor。
- 返回:
Tensor
- 支持平台:
Ascend
CPU
样例:
>>> import mindspore >>> x = mindspore.tensor([True, False, True], mindspore.bool_) >>> y = mindspore.tensor([True, True, False], mindspore.bool_) >>> output = mindspore.ops.logical_xor(x, y) >>> print(output) [False True True] >>> x = mindspore.tensor(1, mindspore.bool_) >>> y = mindspore.tensor(0, mindspore.bool_) >>> output = mindspore.ops.logical_xor(x, y) >>> print(output) True >>> x = True >>> y = mindspore.tensor(0, mindspore.bool_) >>> output = mindspore.ops.logical_xor(x, y) >>> print(output) True >>> x = True >>> y = mindspore.tensor([True, False], mindspore.bool_) >>> output = mindspore.ops.logical_xor(x, y) >>> print(output) [False True]