mindspore.ops.logcumsumexp

View Source On Gitee
mindspore.ops.logcumsumexp(input, axis)[source]

Calculate the log of cumulative summed exponentials of the tensor along a specified dimension.

Warning

This is an experimental API that is subject to change or deletion.

Parameters
  • input (Tensor) – The input tensor.

  • axis (int) – Specify the axis for computation.

Returns

Tensor

Supported Platforms:

Ascend CPU GPU

Examples

>>> import mindspore
>>> input = mindspore.tensor([[9., 3, 4, 5],
...                           [5, 2, 7, 4],
...                           [8, 1, 3, 6]])
>>> # case 1: Compute the log of cumulative summed exponential along dim 0.
>>> output = mindspore.ops.logcumsumexp(input, 0)
>>> print(output)
[[9.        3.        4.        5.       ]
 [9.01815   3.3132617 7.0485873 5.3132615]
 [9.326563  3.407606  7.065884  6.407606 ]]
>>>
>>> # case 2: Compute the log of cumulative summed exponential along dim 1.
>>> output = mindspore.ops.logcumsumexp(input, 1)
>>> print(output)
[[9.        9.002476  9.009174  9.02716  ]
 [5.        5.0485873 7.1328454 7.175515 ]
 [8.        8.000912  8.007621  8.133643 ]]