PyTorch torch.eq Function
Pytorch torch Reference Manual
torch.eqis a function in PyTorch used for element-wise equality comparison.
Function Definition
torch.eq(input, other, out)
Usage Example
Example
import torch
a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([1, 2, 0, 4])
result = torch.eq(a, b)
print(result)
a = torch.tensor([1, 2, 3, 4])
b = torch.tensor([1, 2, 0, 4])
result = torch.eq(a, b)
print(result)
The output result is:
tensor([True, True, False, True])
Other Extensions