oneflow.bitwise_xor

oneflow.bitwise_xor()

Computes the bitwise XOR of input and other. The input tensor must be of integral or Boolean types. For bool tensors, it computes the logical XOR.

The interface is consistent with PyTorch. The documentation is referenced from: https://pytorch.org/docs/1.10/generated/torch.bitwise_xor.html

Parameters
Returns

The output Tensor

Return type

oneflow.Tensor

For example:

>>> import oneflow as flow
>>> x = flow.tensor([1, 2, 3])
>>> flow.bitwise_xor(x, 2)
tensor([3, 0, 1], dtype=oneflow.int64)
>>> y = flow.tensor([5, 6, 7])
>>> flow.bitwise_xor(x, y)
tensor([4, 4, 4], dtype=oneflow.int64)