mindspore/docs/api/api_python/mint/mindspore.mint.nn.ELU.rst

38 lines
1.2 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.ELU
=====================
.. py:class:: mindspore.mint.nn.ELU(alpha=1.0, inplace=False)
指数线性单元激活函数(Exponential Linear Unit activation function)。
对输入的每个元素计算ELU。该激活函数定义如下
.. math::
ELU_{i} =
\begin{cases}
x_i, &\text{if } x_i \geq 0; \cr
\alpha * (\exp(x_i) - 1), &\text{otherwise.}
\end{cases}
其中,:math:`x_i` 表示输入的元素,:math:`\alpha` 表示 `alpha` 参数该参数决定ELU的平滑度。
ELU函数图
.. image:: ../images/ELU.png
:align: center
.. warning::
这是一个实验性API后续可能修改或删除。
参数:
- **alpha** (float, 可选) - ELU公式的alpha值。默认值``1.0``
- **inplace** (bool, 可选) - 是否执行in-place操作。默认值``False``
输入:
- **input** (Tensor) - 任意维度的输入Tensor。
输出:
Tensor输出的shape和数据类型与 `input` 相同。
异常:
- **RuntimeError** - 如果 `input` 的数据类型不是float16、float32或bfloat16。