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

PyTorch torch.bitwise_not function

PyTorch torch.bitwise_not function

PyTorch torch.bitwise_not function


PyTorch torch reference manual PyTorch torch reference manual

torch.bitwise_not is a function in PyTorch used for element-wise bitwise NOT.

Function definition

torch.bitwise_not(input, *, out=None)


Usage examples

Example

import

torch

Bitwise NOT example

x

=

torch.

tensor

(

[

0

,

1

,

2

,

3

]

,

dtype

=

torch.

int8

)

result

=

torch.

bitwise_not

(

x

)

print

(

result

)

 

tensor([-1, -2, -3, -4], dtype=int8)


PyTorch torch reference manual PyTorch torch reference manual