chainer.functions.clipped_relu

chainer.functions.clipped_relu(x, z=20.0)[source]

Clipped Rectifier Unit function.

For a clipping value \(z(>0)\), it computes

Parameters:
  • x (Variable or numpy.ndarray or cupy.ndarray) – Input variable. A \((s_1, s_2, ..., s_n)\)-shaped float array.
  • z (float) – Clipping value. (default = 20.0)
Returns:

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

Return type:

Variable

Example

>>> x = np.random.uniform(-100, 100, (10, 20)).astype('f')
>>> z = 10.0
>>> np.any(x < 0)
True
>>> np.any(x > z)
True
>>> y = F.clipped_relu(x, z=z)
>>> np.any(y.data < 0)
False
>>> np.any(y.data > z)
False