chainer.functions.leaky_relu

chainer.functions.leaky_relu(x, slope=0.2)[source]

Leaky Rectified Linear Unit function.

This function is expressed as

f(x)={xif x0axif x<0,

where a is a configurable slope value.

Parameters
Returns

Output variable. A (s1,s2,...,sN)-shaped float array.

Return type

Variable

Example

>>> x = np.array([[-1, 0], [2, -3], [-2, 1]], np.float32)
>>> x
array([[-1.,  0.],
       [ 2., -3.],
       [-2.,  1.]], dtype=float32)
>>> F.leaky_relu(x, slope=0.2).array
array([[-0.2,  0. ],
       [ 2. , -0.6],
       [-0.4,  1. ]], dtype=float32)