Skip to contents

Logcumsumexp

Usage

torch_logcumsumexp(self, dim)

Arguments

self

(Tensor) the input tensor.

dim

(int) the dimension to do the operation over

logcumsumexp(input, dim, *, out=None) -> Tensor

Returns the logarithm of the cumulative summation of the exponentiation of elements of input in the dimension dim.

For summation index j given by dim and other indices i, the result is

logcumsumexp(x)ij=logj=0iexp(xij)

Examples

if (torch_is_installed()) {

a <- torch_randn(c(10))
torch_logcumsumexp(a, dim=1)
}
#> torch_tensor
#>  0.9688
#>  1.1071
#>  1.9102
#>  1.9969
#>  2.1436
#>  2.5344
#>  2.5822
#>  2.6182
#>  2.7154
#>  2.9387
#> [ CPUFloatType{10} ]