mindspore.Tensor.bitwise_xor

Tensor.bitwise_xor(x)[source]

Returns bitwise xor of two tensors element-wise.

Refer to mindspore.ops.bitwise_xor() for more detail.

Parameters

x (Tensor) – The input tensor with int16, int32 or uint16 data type.

Returns

Tensor, has the same type as the x.

Supported Platforms:

Ascend GPU CPU

Examples

>>> from mindspore import Tensor
>>> import numpy as np
>>> a = Tensor(np.array([0, 0, 1, -1, 1, 1, 1]), mindspore.int16)
>>> b = Tensor(np.array([0, 1, 1, -1, -1, 2, 3]), mindspore.int16)
>>> output = a.bitwise_xor(b)
>>> print(output)
[ 0  1  0  0 -2  3  2]