PyTorch torch.less_equal function
PyTorch torch reference manual
torch.less_equal is a function in PyTorch used for element-wise less-than-or-equal comparison. It returns a tensor that is True at positions where an element of the first tensor is less than or equal to the corresponding element of the second tensor.
Function definition
torch.less_equal(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-or-equal comparison
result
=
torch.
less_equal
(
x
,
y
)
(
result
)
The output is:
tensor([False, False, True])