评价此页

RReLU#

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

Applies the randomized leaky rectified linear unit function, element-wise.

Method 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}.

参数
  • lower (float) – 均匀分布的下界。默认值:18\frac{1}{8}

  • upper (float) – 均匀分布的上界。默认值:13\frac{1}{3}

  • inplace (bool) – 可选地执行原地操作。默认值:False

形状
  • 输入:()(*),其中 * 表示任意数量的维度。

  • 输出:()(*),与输入形状相同。

../_images/RReLU.png

示例

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