mindspore.ops.logcumsumexp

mindspore.ops.logcumsumexp(input, axis)[source]

Compute the cumulative log-sum-exp of the input tensor input along axis . For example, if input is a tensor [a, b, c] and axis is 0, the output will be [a, log(exp(a) + exp(b)), log(exp(a) + exp(b) + exp(c))].

Warning

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

Parameters
  • input (Tensor) – float16, float32, float64.

  • axis (int) – Must be in the range [-rank(input), rank(input)).

Returns

Tensor, has the same dtype and shape as the input.

Raises
  • TypeError – If input is not a Tensor.

  • TypeError – If dtype of input is not in [float16, float32, float64].

  • TypeError – If dtype of axis is not int.

  • ValueError – If axis is out of range [-rank(input), rank(input)).

Supported Platforms:

Ascend CPU GPU

Examples

>>> import mindspore as ms
>>> import mindspore.ops as ops
>>> import numpy as np
>>> x = ms.Tensor(np.array([1.0, 2.0, 3.0]).astype(np.float32))
>>> output = ops.logcumsumexp(x, 0)
>>> print(output)
[1.        2.3132617 3.407606 ]