mindspore/docs/api/api_python/mint/mindspore.mint.nn.functiona...

30 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.mint.nn.functional.softplus
=====================================
.. py:function:: mindspore.mint.nn.functional.softplus(input, beta=1, threshold=20)
将softplus函数作用于 `input` 的每个元素上。
softplus函数如下所示其中x是 `input` 中的元素:
.. math::
\text{output} = \frac{1}{beta}\log(1 + \exp(\text{beta * x}))
:math:`input * beta > threshold`为保证数值稳定性softplus的实现被转换为线性函数。
参数:
- **input** (Tensor) - 任意维度的输入Tensor。支持数据类型
- Ascendfloat16、float32、bfloat16。
- **beta** (number.Number可选) - softplus函数中的缩放参数。默认值``1``
- **threshold** (number.Number可选) - 为了数值稳定性softplus函数转换为线性函数的阈值参数。默认值``20``
返回:
Tensor其数据类型和shape与 `input` 相同。
异常:
- **TypeError** - `input` 不是Tensor。
- **TypeError** - `input` 的数据类型非float16、float32、bfloat16。