mindspore.ops.BitwiseXor

class mindspore.ops.BitwiseXor(*args, **kwargs)[source]

Returns bitwise xor of two tensors element-wise.

Inputs of input_x1 and input_x2 comply with the implicit type conversion rules to make the data types consistent. If they have different data types, lower priority data type will be converted to relatively highest priority data type. RuntimeError exception will be thrown when the data type conversion of Parameter is required.

Inputs:
  • input_x1 (Tensor) - The input tensor with int16, int32 or uint16 data type.

  • input_x2 (Tensor) - The input tensor with same type as the input_x1.

Outputs:

Tensor, has the same type as the input_x1.

Raises

TypeError – If input_x1 or input_x2 is not a Tensor.

Supported Platforms:

Ascend

Examples

>>> input_x1 = Tensor(np.array([0, 0, 1, -1, 1, 1, 1]), mindspore.int16)
>>> input_x2 = Tensor(np.array([0, 1, 1, -1, -1, 2, 3]), mindspore.int16)
>>> bitwise_xor = ops.BitwiseXor()
>>> output = bitwise_xor(input_x1, input_x2)
>>> print(output)
[ 0  1  0  0 -2  3  2]