Amax
Usage
torch_amax(self, dim = list(), keepdim = FALSE)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 keepdim is TRUE, the output tensors are of the same size as inputexcept in the dimension(s)dimwhere they are of size 1. Otherwise,dims are squeezed (see [torch_squeeze()]), resulting in the output tensors having fewer dimension than input`.
amax(input, dim, keepdim=FALSE, *, out=None) -> Tensor
Returns the maximum value of each slice of the input tensor in the given
dimension(s) dim.
Examples
if (torch_is_installed()) {
a <- torch_randn(c(4, 4))
a
torch_amax(a, 1)
}
#> torch_tensor
#>  1.5219
#>  0.4392
#>  1.3695
#>  1.5946
#> [ CPUFloatType{4} ]