PyTorch torch.logical_or Function
Pytorch torch Reference Manual
torch.logical_oris a function in PyTorch used to compute the logical OR (OR) operation of two tensors.
Function Definition
torch.logical_or(input, other, out=None)
Usage Example
Example
import torch
# Create two boolean tensors
x = torch.tensor([True, False, True, False])
y = torch.tensor([True, True, False, False])
# Logical OR operation
z = torch.logical_or(x, y)
print("logical_or:", z)
# Create two boolean tensors
x = torch.tensor([True, False, True, False])
y = torch.tensor([True, True, False, False])
# Logical OR operation
z = torch.logical_or(x, y)
print("logical_or:", z)
The output result is:
logical_or: tensor([True, True, True, False])
Other Extensions