2021-12-04 13:55:42 +08:00
|
|
|
|
mindspore.nn.ReLU
|
|
|
|
|
|
=================
|
|
|
|
|
|
|
|
|
|
|
|
.. py:class:: mindspore.nn.ReLU
|
|
|
|
|
|
|
|
|
|
|
|
修正线性单元激活函数(Rectified Linear Unit activation function)。
|
|
|
|
|
|
|
2021-12-20 15:33:20 +08:00
|
|
|
|
逐元素求 :math:`\max(x,\ 0)` 。特别说明,负数输出值会被修改为0,正数输出不受影响。
|
2021-12-04 13:55:42 +08:00
|
|
|
|
|
|
|
|
|
|
.. math::
|
|
|
|
|
|
|
|
|
|
|
|
\text{ReLU}(x) = (x)^+ = \max(0, x),
|
|
|
|
|
|
|
|
|
|
|
|
ReLU相关图参见 `ReLU <https://en.wikipedia.org/wiki/Activation_function#/media/File:Activation_rectified_linear.svg>`_ 。
|
|
|
|
|
|
|
|
|
|
|
|
**输入:**
|
|
|
|
|
|
|
2022-04-08 09:41:47 +08:00
|
|
|
|
- **x** (Tensor) - 用于计算ReLU的任意维度的Tensor。数据类型为 `number <https://www.mindspore.cn/docs/zh-CN/master/api_python/mindspore.html#mindspore.dtype>`_。
|
2021-12-04 13:55:42 +08:00
|
|
|
|
|
|
|
|
|
|
**输出:**
|
|
|
|
|
|
|
2021-12-20 15:33:20 +08:00
|
|
|
|
Tensor,数据类型和shape与 `x` 相同。
|
2021-12-04 13:55:42 +08:00
|
|
|
|
|
|
|
|
|
|
**异常:**
|
|
|
|
|
|
|
2021-12-20 15:33:20 +08:00
|
|
|
|
- **TypeError** - `x` 的数据类型不是number。
|