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