PyTorch torch.minimum Function
Pytorch torch Reference Manual
torch.minimumIt is a function in PyTorch used for element-wise taking the minimum value. It returns a new tensor composed of the minimum values of the corresponding elements of two tensors.
Function Definition
torch.minimum(input, other)
Usage Example
Example
import torch
# Create two tensors
x = torch.tensor([3, 1, 4])
y = torch.tensor([1, 5, 2])
# Take the minimum element-wise
result = torch.minimum(x, y)
print(result)
# Create two tensors
x = torch.tensor([3, 1, 4])
y = torch.tensor([1, 5, 2])
# Take the minimum element-wise
result = torch.minimum(x, y)
print(result)
The output result is:
tensor([1, 1, 2])
Other Extensions