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