RReLU

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

元素级别应用随机泄漏 rectified 线性单元函数。

论文中提出的方法:卷积网络中修正激活函数的实证评估

该函数的定义如下:

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

其中,$a$在训练过程中从均匀分布$\mathcal{U}(\text{lower}, \text{upper})$中随机抽取,而在评估过程中则固定为$a = \frac{\text{lower} + \text{upper}}{2}$

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

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

  • inplace (bool) – 是否以就地方式执行操作(可选)。默认值: False

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

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

{BASE_RAW_UPLOAD_URL}/pytorch-doc-2.5/0a6eb08ea5222595d4d4bb28f3b0d2dd.png

示例:

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