mindspore/docs/api/api_python/nn/mindspore.nn.LeakyReLU.rst

33 lines
881 B
ReStructuredText
Raw Normal View History

mindspore.nn.LeakyReLU
=======================
.. py:class:: mindspore.nn.LeakyReLU(alpha=0.2)
Leaky ReLU激活函数。
该激活函数定义如下:
.. math::
\text{leaky_relu}(x) = \begin{cases}x, &\text{if } x \geq 0; \cr
{\alpha} * x, &\text{otherwise.}\end{cases}
其中,:math:`\alpha` 表示 `alpha` 参数。
更多细节详见 `Rectifier Nonlinearities Improve Neural Network Acoustic Models <https://ai.stanford.edu/~amaas/papers/relu_hybrid_icml2013_final.pdf>`_
2021-12-07 12:17:56 +08:00
**参数:**
2021-12-07 12:17:56 +08:00
**alpha** (`Union[int, float]`) x<0时激活函数的斜率默认值0.2。
2021-12-07 12:17:56 +08:00
**输入:**
**x** Tensor - 计算LeakyReLU的任意维度的Tensor。
2021-12-07 12:17:56 +08:00
**输出:**
Tensor数据类型和shape与 `x` 相同。
2021-12-07 12:17:56 +08:00
**异常:**
2021-12-07 12:17:56 +08:00
**TypeError** - `alpha` 不是浮点数或整数。