chainer.functions.relu6

chainer.functions.relu6(x)[source]

Rectifier Unit function clipped at 6.

It computes

\[\text{ReLU6}(x) = \min(\max(0, x), 6).\]
Parameters

x (Variable or N-dimensional array) – Input variable. A \((s_1, s_2, ..., s_n)\)-shaped float array.

Returns

Output variable. A \((s_1, s_2, ..., s_n)\)-shaped float array.

Return type

Variable

Example

>>> x = np.array([-20, -2, 0, 2, 4, 10, 100]).astype(np.float32)
>>> x
array([-20.,  -2.,   0.,   2.,   4.,  10., 100.], dtype=float32)
>>> F.relu6(x)
variable([0., 0., 0., 2., 4., 6., 6.])