Cummax
Source:R/gen-namespace-docs.R, R/gen-namespace-examples.R, R/gen-namespace.R
torch_cummax.RdCummax
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.
Examples
if (torch_is_installed()) {
a = torch_randn(c(10))
a
torch_cummax(a, dim=1)
}
#> [[1]]
#> torch_tensor
#> -0.2400
#> 0.3693
#> 0.3693
#> 0.3693
#> 0.3693
#> 0.3693
#> 1.1633
#> 1.1633
#> 1.1633
#> 1.1633
#> [ CPUFloatType{10} ]
#>
#> [[2]]
#> torch_tensor
#> 0
#> 1
#> 1
#> 1
#> 1
#> 1
#> 6
#> 6
#> 6
#> 6
#> [ CPULongType{10} ]
#>