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)=maxwhere a is a random number sampled from a uniform distribution U(l, u).
See: https://arxiv.org/pdf/1505.00853.pdf
- Parameters
x (
Variable
or 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.ndarray
or 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. Ifr
is not specified or set toNone
, ar
will be generated randomly according to the givenl
andu
. Ifr
is specified,l
andu
will be ignored.return_r (bool) – If
True
, the r used for rrelu is returned altogether with the output variable. The returnedr
can latter be reused by passing it tor
argument.
- Returns
When
return_r
isFalse
(default), return the output variable. Otherwise returnes the tuple of the output variable andr
(ndarray). Ther
will 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)