mindspore/docs/api/api_python/ops/mindspore.ops.func_elu.rst

32 lines
1.2 KiB
ReStructuredText
Raw Normal View History

mindspore.ops.elu
=================
.. py:function:: mindspore.ops.elu(input_x, alpha=1.0)
指数线性单元激活函数。
对输入的每个元素计算ELU。该激活函数定义如下
.. math::
2022-11-12 05:15:26 +08:00
\text{ELU}(x)= \left\{
\begin{array}{align}
\alpha(e^{x} - 1) & \text{if } x \le 0\\
x & \text{if } x \gt 0\\
\end{array}\right.
2022-11-12 05:15:26 +08:00
其中,:math:`x` 表示输入Tensor `input_x` :math:`\alpha` 表示 `alpha` 参数, `alpha` 决定ELU的平滑度。
2022-11-01 19:52:13 +08:00
ELU相关图参见 `ELU <https://en.wikipedia.org/wiki/Activation_function#/media/File:Activation_elu.svg>`_
参数:
2022-11-01 19:52:13 +08:00
- **input_x** (Tensor) - ELU的输入为任意维度的Tensor数据类型为float16或float32。
2022-11-12 05:15:26 +08:00
- **alpha** (float) - ELU的alpha值数据类型为float目前仅支持1.0。默认值1.0。
返回:
Tensor输出的shape、数据类型与 `input_x` 相同。
异常:
- **TypeError** - 如果 `alpha` 不是float。
- **TypeError** - 如果 `input_x` 的数据类型既不是float16也不是float32。
- **ValueError** - 如果 `alpha` 不等于1.0。