ReLU6
- 类torch.ao.nn.quantized.ReLU6(inplace=False)[源代码]
-
应用逐元素函数:
$\text{ReLU6}(x) = \min(\max(x_0, x), q(6))$,其中$x_0$表示零点,$q(6)$是数字 6 的量化形式。
- 参数
-
inplace (bool) – 是否以就地方式执行操作(可选)。默认值:
False
- 形状:
-
-
输入: $(N, *)$,其中 * 表示任意数量的额外维度。
-
输出: $(N, *)$,形状与输入相同
-
示例:
>>> m = nn.quantized.ReLU6() >>> input = torch.randn(2) >>> input = torch.quantize_per_tensor(input, 1.0, 0, dtype=torch.qint32) >>> output = m(input)