PyTorch torch.eq function
PyTorch torch reference manual
torch.eq is a PyTorch function for element-wise equality comparison.
Function definition
torch.eq(input, other, out)
Usage examples
Example
import
torch
a
=
torch.
tensor
(
[
1
,
2
,
3
,
4
]
)
b
=
torch.
tensor
(
[
1
,
2
,
0
,
4
]
)
result
=
torch.
eq
(
a
,
b
)
(
result
)
The output is:
tensor([True, True, False, True])