PyTorch torch.logical_or function
PyTorch torch reference manual
torch.logical_or is a function in PyTorch used to compute the logical OR of two tensors.
Function definition
torch.logical_or(input, other, out=None)
Usage examples
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
)
(
"logical_or:"
,
z
)
The output is:
logical_or: tensor([True, True, True, False])