PyTorch torch.logical_not Function
Pytorch torch Reference Manual
torch.logical_notis a function in PyTorch used to compute the logical NOT operation.
Function Definition
torch.logical_not(input, out=None)
Usage Example
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)
# 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 result is:
logical_not: tensor([False, True, False, True])
Other Extensions