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
#> 1.0030
#> 1.6436
#> 1.7809
#> 1.8876
#> 1.9299
#> 2.0670
#> 2.2892
#> 3.0567
#> 3.0929
#> 3.1219
#> [ CPUFloatType{10} ]