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

PyTorch torch.logical_or function

PyTorch torch.logical_or function


PyTorch torch reference manual 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

)

print

(

"logical_or:"

,

z

)

The output is:

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


PyTorch torch reference manual PyTorch torch reference manual