bitwise_xor

paddle. bitwise_xor ( x: Tensor, y: Tensor, name: str | None = None, *, out: Tensor | None = None ) → Tensor [source]

Apply bitwise_xor on Tensor X and Y.

\[\begin{split}Out = X ^\\wedge Y\end{split}\]

Note

paddle.bitwise_xor supports broadcasting. If you want know more about broadcasting, please refer to Introduction to Tensor .

Parameters
  • x (Tensor) – Input Tensor of bitwise_xor. It is a N-D Tensor of bool, uint8, int8, int16, int32, int64. Alias: input.

  • y (Tensor) – Input Tensor of bitwise_xor. It is a N-D Tensor of bool, uint8, int8, int16, int32, int64. Alias: other.

  • name (str|None, optional) – The default value is None. Normally there is no need for user to set this property. For more information, please refer to api_guide_Name.

Keyword Arguments

out (Tensor, optional) – The output Tensor. If set, the result will be stored in this Tensor. Default: None.

Returns

Result of bitwise_xor. It is a N-D Tensor with the same data type of input Tensor.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.to_tensor([-5, -1, 1])
>>> y = paddle.to_tensor([4,  2, -3])
>>> res = paddle.bitwise_xor(x, y)
>>> print(res)
Tensor(shape=[3], dtype=int64, place=Place(cpu), stop_gradient=True,
[-1, -3, -4])