快捷方式

RReLU

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

应用随机化 Leaky 修正线性单元函数,按元素进行。

该方法在以下论文中描述: Empirical Evaluation of Rectified Activations in Convolutional Network

函数定义为

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)

文档

访问 PyTorch 的全面开发者文档

查看文档

教程

获取针对初学者和高级开发者的深度教程

查看教程

资源

查找开发资源并获得问题解答

查看资源