PyTorch torch.minimum function
PyTorch torch reference manual
torch.minimum is a function in PyTorch used to take the element-wise minimum. It returns a new tensor made of the minimum of corresponding elements of two tensors.
Function definition
torch.minimum(input, other)
Usage examples
Example
import
torch
Create two tensors
x
=
torch.
tensor
(
[
3
,
1
,
4
]
)
y
=
torch.
tensor
(
[
1
,
5
,
2
]
)
Element-wise minimum
result
=
torch.
minimum
(
x
,
y
)
(
result
)
The output is:
tensor([1, 1, 2])