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

PyTorch torch.logical_not function

PyTorch torch.logical_not function


PyTorch torch reference manual PyTorch torch reference manual

torch.logical_not is a function in PyTorch used to compute the logical NOT operation.

Function definition

torch.logical_not(input, out=None)


Usage examples

Example

import

torch

Create a Boolean tensor

x

=

torch.

tensor

(

[

True

,

False

,

True

,

False

]

)

Logical NOT operation

y

=

torch.

logical_not

(

x

)

print

(

"logical_not:"

,

y

)

The output is:

logical_not: tensor([False, True, False, True])


PyTorch torch reference manual PyTorch torch reference manual