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

31 lines
1.2 KiB
ReStructuredText
Raw 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.elu
=================
.. py:function:: mindspore.ops.elu(input_x, alpha=1.0)
指数线性单元激活函数。
对输入的每个元素计算ELU。该激活函数定义如下
.. math::
\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.
其中,:math:`x` 表示输入的元素,:math:`\alpha` 表示 `alpha` 参数, `alpha` 决定ELU的平滑度。
ELU相关图参见 `ELU <https://en.wikipedia.org/wiki/Activation_function#/media/File:Activation_elu.svg>`_
参数:
- **input_x** (Tensor) - ELU的输入为任意维度的Tensor数据类型为float16或float32。
- **alpha** (float) - ELU的alpha值数据类型为浮点数目前仅支持1.0。默认值1.0。
返回:
Tensor输出的shape、数据类型与 `input_x` 相同。
异常:
- **TypeError** - 如果 `alpha` 不是float。
- **TypeError** - 如果 `input_x` 的数据类型既不是float16也不是float32。
- **ValueError** - 如果 `alpha` 不等于1.0。