# ReLU6¶

class torch.nn.quantized.ReLU6(inplace=False)[source]

Applies the element-wise function:

$\text{ReLU6}(x) = \min(\max(x_0, x), q(6))$, where $x_0$ is the zero_point, and $q(6)$ is the quantized representation of number 6.

Parameters

inplace – can optionally do the operation in-place. Default: False

Shape:
• Input: $(N, *)$ where * means, any number of additional dimensions

• Output: $(N, *)$, same shape as the input

Examples:

>>> m = nn.quantized.ReLU6()
>>> input = torch.randn(2)
>>> input = torch.quantize_per_tensor(input, 1.0, 0, dtype=torch.qint32)
>>> output = m(input)