1mindspore.mint.nn.functional.leaky_relu 2======================================= 3 4.. py:function:: mindspore.mint.nn.functional.leaky_relu(input, negative_slope=0.01) 5 6 leaky_relu激活函数。 `input` 中小于0的元素乘以 `negative_slope` 。 7 8 该激活函数定义如下: 9 10 .. math:: 11 \text{leaky_relu}(input) = \begin{cases}input, &\text{if } input \geq 0; \cr 12 \text{negative_slope} * input, &\text{otherwise.}\end{cases} 13 14 其中,:math:`negative\_slope` 表示 `negative_slope` 参数。 15 16 更多细节详见 `Rectifier Nonlinearities Improve Neural Network Acoustic Models <https://ai.stanford.edu/~amaas/papers/relu_hybrid_icml2013_final.pdf>`_ 。 17 18 LeakyReLU函数图: 19 20 .. image:: ../images/LeakyReLU.png 21 :align: center 22 23 参数: 24 - **input** (Tensor) - 计算leaky_relu的任意维度的Tensor。 25 - **negative_slope** (Union[int, float]) - `input` 的元素小于0时激活函数的斜率,默认值: ``0.01`` 。 26 27 返回: 28 Tensor,数据类型和shape与 `input` 相同。 29 30 异常: 31 - **TypeError** - `input` 不是Tensor。 32 - **TypeError** - `negative_slope` 不是浮点数或整数。 33