chainer.functions.rrelu¶
-
chainer.functions.rrelu(x, l=1. / 8, u=1. / 3, *, r=None, return_r=False)[source]¶ Randomized Leaky Rectified Liner Unit function.
This function is expressed as
\[f(x)=\max(x, ax),\]where \(a\) is a random number sampled from a uniform distribution \(U(l, u)\).
See: https://arxiv.org/pdf/1505.00853.pdf
- Parameters
x (
Variableor N-dimensional array) – Input variable. A \((s_1, s_2, ..., s_N)\)-shaped float array.l (float) – The lower bound of the uniform distribution.
u (float) – The upper bound of the uniform distribution.
r (
numpy.ndarrayor None) – The r to be used for rrelu. The shape and dtype must be the same asx[0]and should be on the same device. Ifris not specified or set toNone, arwill be generated randomly according to the givenlandu. Ifris specified,landuwill be ignored.return_r (bool) – If
True, the r used for rrelu is returned altogether with the output variable. The returnedrcan latter be reused by passing it torargument.
- Returns
When
return_risFalse(default), return the output variable. Otherwise returnes the tuple of the output variable andr(ndarray). Therwill be on the same device as the input. A \((s_1, s_2, ..., s_N)\)-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.rrelu(x).array # doctest: +SKIP array([[-0.24850948, 0. ], [ 2. , -0.50844127], [-0.598535 , 1. ]], dtype=float32)