mindspore.mint.logsumexp
- mindspore.mint.logsumexp(input, dim, keepdim=False)[source]
Calculate the logarithm of the sum of exponentiations of all elements along the specified dim dimension of the input tensor.
\[logsumexp(input) = \log(\sum(e^{input-input_{max}})) + input_{max}\]Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
Examples
>>> import numpy as np >>> import mindspore >>> x = mindspore.tensor(np.random.randn(3, 4, 5, 6).astype(np.float32)) >>> output = mindspore.mint.logsumexp(x, 1, keepdim=True) >>> print(output.shape) (3, 1, 5, 6)