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 x≥0axif x<0,where a is a configurable slope value.
- Parameters
x (
Variable
or N-dimensional array) – Input variable. A (s1,s2,...,sN)-shaped float array.slope (float) – Slope value a.
- Returns
Output variable. A (s1,s2,...,sN)-shaped float array.
- Return type
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)