RReLU

class torch.nn.RReLU(lower=0.125, upper=0.3333333333333333, inplace=False) [source]

Applies the randomized leaky rectified liner unit function, element-wise, as described in the paper:

Empirical Evaluation of Rectified Activations in Convolutional Network.

The function is defined as:

RReLU(x)={xif x0ax otherwise \text{RReLU}(x) = \begin{cases} x & \text{if } x \geq 0 \\ ax & \text{ otherwise } \end{cases}

where aa is randomly sampled from uniform distribution U(lower,upper)\mathcal{U}(\text{lower}, \text{upper}) during training while during evaluation aa is fixed with a=lower+upper2a = \frac{\text{lower} + \text{upper}}{2}.

See: https://arxiv.org/pdf/1505.00853.pdf

Parameters
  • lower (float) – lower bound of the uniform distribution. Default: 18\frac{1}{8}
  • upper (float) – upper bound of the uniform distribution. Default: 13\frac{1}{3}
  • inplace (bool) – can optionally do the operation in-place. Default: False
Shape:
  • Input: ()(*), where * means any number of dimensions.
  • Output: ()(*), same shape as the input.
../_images/RReLU.png

Examples:

>>> m = nn.RReLU(0.1, 0.3)
>>> input = torch.randn(2)
>>> output = m(input)

© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.nn.RReLU.html