torch_amax {torch}R Documentation

Amax

Description

Amax

Usage

torch_amax(self, dim = list(), keepdim = FALSE)

Arguments

self

(Tensor) the input tensor.

dim

(int or tuple of ints) the dimension or dimensions to reduce.

keepdim

(bool) whether the output tensor has dim retained or not.

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.

Note

The difference between max/min and amax/amin is:

If ⁠keepdim is ⁠TRUE⁠, the output tensors are of the same size as ⁠input⁠except in the dimension(s)⁠dim⁠where they are of size 1. Otherwise,⁠dim⁠s are squeezed (see [torch_squeeze()]), resulting in the output tensors having fewer dimension than ⁠input'.

Examples

if (torch_is_installed()) {

a <- torch_randn(c(4, 4))
a
torch_amax(a, 1)
}

[Package torch version 0.13.0 Index]