pytorch / 1.8.0 / generated / torch.logcumsumexp.html /

torch.logcumsumexp

torch.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 j given by dim and other indices i i , the result is

logcumsumexp ( x ) i j = log j = 0 i exp ( x i j ) \text{logcumsumexp}(x)_{ij} = \log \sum\limits_{j=0}^{i} \exp(x_{ij})
Parameters
  • input (Tensor) – the input tensor.
  • dim (int) – the dimension to do the operation over
Keyword Arguments

out (Tensor, optional) – the output tensor.

Example::
>>> a = torch.randn(10)
>>> torch.logcumsumexp(a, dim=0)
tensor([-0.42296738, -0.04462666,  0.86278635,  0.94622083,  1.05277811,
         1.39202815,  1.83525007,  1.84492621,  2.06084887,  2.06844475]))

© 2019 Torch Contributors
Licensed under the 3-clause BSD License.
https://pytorch.org/docs/1.8.0/generated/torch.logcumsumexp.html