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