PyTorch torch.logical_not function
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
)
(
"logical_not:"
,
y
)
The output is:
logical_not: tensor([False, True, False, True])