Logcumsumexp
Source:R/gen-namespace-docs.R
, R/gen-namespace-examples.R
, R/gen-namespace.R
torch_logcumsumexp.Rd
Logcumsumexp
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
$$ \mbox{logcumsumexp}(x)_{ij} = \log \sum\limits_{j=0}^{i} \exp(x_{ij}) $$
Examples
if (torch_is_installed()) {
a <- torch_randn(c(10))
torch_logcumsumexp(a, dim=1)
}
#> torch_tensor
#> 0.7236
#> 0.9456
#> 1.1725
#> 2.1297
#> 2.2222
#> 2.2610
#> 2.4665
#> 2.5697
#> 2.6306
#> 2.6780
#> [ CPUFloatType{10} ]