PyTorch torch.less function
PyTorch torch reference manual
torch.less is a function in PyTorch used for element-wise less-than comparison. It returns a tensor that is True at positions where an element of the first tensor is less than the corresponding element of the second tensor.
Function definition
torch.less(input, other)
Usage examples
Example
import
torch
Create two tensors
x
=
torch.
tensor
(
[
3
,
5
,
2
]
)
y
=
torch.
tensor
(
[
2
,
4
,
2
]
)
Element-wise less-than comparison
result
=
torch.
less
(
x
,
y
)
(
result
)
The output is:
tensor([False, False, False])