评价此页

RReLU#

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

逐元素应用随机的 Leaky Rectified Linear Unit 函数。

论文中描述的方法:用于卷积网络的激活函数经验评估

该函数定义为

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

参数
  • 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)
extra_repr()[源代码]#

返回模块的额外表示。

返回类型

str

forward(input)[源代码]#

执行前向传播。

返回类型

张量