Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.bitwise_xor function

PyTorch torch.bitwise_xor function

PyTorch torch.bitwise_xor function


PyTorch torch reference manual PyTorch torch reference manual

torch.bitwise_xor is a function in PyTorch used for element-wise bitwise XOR.

Function definition

torch.bitwise_xor(input, other, *, out=None)


Usage examples

Example

import

torch

Bitwise XOR example

x

=

torch.

tensor

(

[

5

,

3

,

7

]

,

dtype

=

torch.

int8

)

y

=

torch.

tensor

(

[

1

,

3

,

4

]

,

dtype

=

torch.

int8

)

result

=

torch.

bitwise_xor

(

x

,

y

)

print

(

result

)

 

tensor([4, 0, 3], dtype=int8)


PyTorch torch reference manual PyTorch torch reference manual