2022-08-27 10:55:12 +08:00
|
|
|
|
mindspore.ops.relu6
|
|
|
|
|
|
====================
|
|
|
|
|
|
|
2022-09-16 11:06:56 +08:00
|
|
|
|
.. py:function:: mindspore.ops.relu6(x)
|
2022-08-27 10:55:12 +08:00
|
|
|
|
|
|
|
|
|
|
计算输入Tensor的ReLU(修正线性单元),其上限为6。
|
|
|
|
|
|
|
|
|
|
|
|
.. math::
|
|
|
|
|
|
\text{ReLU6}(x) = \min(\max(0,x), 6)
|
|
|
|
|
|
|
|
|
|
|
|
返回 :math:`\min(\max(0,x), 6)` 元素的值。
|
|
|
|
|
|
|
|
|
|
|
|
参数:
|
2022-09-16 11:06:56 +08:00
|
|
|
|
- **x** (Tensor) - relu6的输入,shape: :math:`(N, *)` ,其中 :math:`*` 表示任意数量的附加维度,数据类型为float16或float32。
|
2022-08-27 10:55:12 +08:00
|
|
|
|
|
|
|
|
|
|
返回:
|
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` 的数据类型既不是float16也不是float32。
|
|
|
|
|
|
- **TypeError** - 如果 `x` 不是Tensor。
|