2022-08-27 10:55:12 +08:00
|
|
|
|
mindspore.ops.relu
|
|
|
|
|
|
==================
|
|
|
|
|
|
|
2022-09-16 11:06:56 +08:00
|
|
|
|
.. py:function:: mindspore.ops.relu(x)
|
2022-08-27 10:55:12 +08:00
|
|
|
|
|
2022-11-02 19:28:41 +08:00
|
|
|
|
对输入Tensor逐元素计算线性修正单元激活函数(Rectified Linear Unit)值。
|
2022-08-27 10:55:12 +08:00
|
|
|
|
|
2022-10-11 16:55:36 +08:00
|
|
|
|
返回 :math:`\max(x,\ 0)` 的值。负值神经元将被设置为0,正值神经元将保持不变。
|
2022-08-27 10:55:12 +08:00
|
|
|
|
|
|
|
|
|
|
.. math::
|
|
|
|
|
|
ReLU(x) = (x)^+ = max(0, x)
|
|
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
一般来说,与 `ReLUV2` 相比,此算子更常用。且 `ReLUV2` 会多输出一个掩码。
|
|
|
|
|
|
|
|
|
|
|
|
参数:
|
2022-09-16 11:06:56 +08:00
|
|
|
|
- **x** (Tensor) - relu的输入,shape: :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度,
|
2022-08-27 10:55:12 +08:00
|
|
|
|
其数据类型为 `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_。
|
|
|
|
|
|
|
|
|
|
|
|
返回:
|
2022-09-16 11:06:56 +08:00
|
|
|
|
Tensor,数据类型和shape与 `x` 相同。
|
2022-08-27 10:55:12 +08:00
|
|
|
|
|
|
|
|
|
|
异常:
|
2022-09-16 11:06:56 +08:00
|
|
|
|
- **TypeError** - `x` 的数据类型不是数值型。
|
|
|
|
|
|
- **TypeError** - `x` 不是Tensor。
|