On this page
torch.amin
torch.amin(input, dim, keepdim=False, *, out=None) → Tensor-
Returns the minimum value of each slice of the
inputtensor in the given dimension(s)dim.Note
The difference between max/min and amax/amin is:-
amax/aminsupports reducing on multiple dimensions,amax/amindoes not return indices,amax/aminevenly distributes gradient between equal values, whilemax(dim)/min(dim)propagates gradient only to a single index in the source tensor.
If
keepdimisTrue, the output tensor is of the same size asinputexcept in the dimension(s)dimwhere it is of size 1. Otherwise,dimis squeezed (seetorch.squeeze()), resulting in the output tensor having 1 (orlen(dim)) fewer dimension(s).- Parameters
- Keyword Arguments
-
out (Tensor, optional) – the output tensor.
Example:
>>> a = torch.randn(4, 4) >>> a tensor([[ 0.6451, -0.4866, 0.2987, -1.3312], [-0.5744, 1.2980, 1.8397, -0.2713], [ 0.9128, 0.9214, -1.7268, -0.2995], [ 0.9023, 0.4853, 0.9075, -1.6165]]) >>> torch.amin(a, 1) tensor([-1.3312, -0.5744, -1.7268, -1.6165])
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.amin.html