Shortcuts

RReLU

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

对每个元素应用随机化泄漏修正线性单元函数。

论文中描述的方法: 卷积网络中整流激活的实证评估

该函数定义为:

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

其中 aa 是从均匀分布中随机采样的 U(lower,upper)\mathcal{U}(\text{lower}, \text{upper}) 在训练期间,而在评估期间 aa 固定为 a=lower+upper2a = \frac{\text{lower} + \text{upper}}{2}

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

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

  • inplace (布尔值) – 可以选择就地执行操作。默认值:False

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

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

../_images/RReLU.png

示例:

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