mindspore.ops.logsumexp
- mindspore.ops.logsumexp(input, dim, keepdim=False)[source]
Calculate the log of summed exponentials of the tensor along a specified dimension.
- Parameters
- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore >>> input = mindspore.tensor([[9., 3, 4, 5], ... [5, 2, 7, 4], ... [8, 1, 3, 6]]) >>> # case 1: By default, compute the log of summed exponential of all elements. >>> output = mindspore.ops.logsumexp(input, ()) >>> print(output) 9.475807 >>> >>> # case 2: Compute the log of summed exponential along dim 0. >>> output = mindspore.ops.logsumexp(input, 0) >>> print(output) [9.326562 3.4076054 7.065884 6.4076056] >>> >>> # case 3: If keepdim=True, the output shape will be same of that of the input. >>> output = mindspore.ops.logsumexp(input, 1, True) >>> print(output) [[9.02716 ] [7.175515] [8.133643]]