torch_cummax: Cummax

View source: R/gen-namespace.R

torch_cummaxR Documentation

Cummax

Description

Cummax

Usage

torch_cummax(self, dim)

Arguments

self

(Tensor) the input tensor.

dim

(int) the dimension to do the operation over

cummax(input, dim) -> (Tensor, LongTensor)

Returns a namedtuple ⁠(values, indices)⁠ where values is the cumulative maximum of elements of input in the dimension dim. And indices is the index location of each maximum value found in the dimension dim.

y_i = max(x_1, x_2, x_3, \dots, x_i)

Examples

if (torch_is_installed()) {

a = torch_randn(c(10))
a
torch_cummax(a, dim=1)
}

torch documentation built on June 7, 2023, 6:19 p.m.