mindspore/docs/api/api_python/ops/mindspore.ops.func_logsumex...

26 lines
1.1 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.ops.logsumexp
=======================
.. py:function:: mindspore.ops.logsumexp(x, axis, keep_dims=False)
求Tensor的对数指数和。
.. math::
logsumexp(x) = \log(\sum e^{x-x_{max}}) + x_{max}
.. note::
Ascend上输入Tensor的维度要小于等于8CPU上输入Tensor的维度要小于8。
参数:
- **x** (Tensor) - 任意维度的输入Tensor。数据类型为float16或float32。
- **axis** (Union[int, tuple(int), list(int)]) - 需要reduce的维度输入为 `()` 时reduce所有维度。
- **keep_dims** (bool) - 是否保留reduce的维度。若设为True则计算后指定的axis的长度为1否则不保留该维度。默认值False。
返回:
Tensor具有与 `x` 相同的数据类型。
- 若axis为(),且 `keep_dims` 设为False则输出为零维Tensor。
- 若axis为int类型假设为2`keep_dims` 设为False则输出的shape为 :math:`(x_1, x_3, ..., x_R)`
- 若axis为tuple(int),假设为(2, 3),且 `keep_dims` 为False则输出shape为 :math:`(x_1, x_4, ..., x_R)`