mindspore.mint.nn.ReLU6
- class mindspore.mint.nn.ReLU6(inplace=False)[源代码]
逐元素计算ReLU6(修正线性单元上限为6)激活函数。
更多参考详见
mindspore.mint.nn.functional.relu6()。ReLU6激活函数图:
- 支持平台:
Ascend
样例:
>>> import mindspore >>> relu6 = mindspore.mint.nn.ReLU6(inplace=True) >>> input_tensor = mindspore.tensor([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]], mindspore.float32) >>> output = relu6(input_tensor) >>> print(output) [[0. 4. 0.] [2. 0. 6.]]