評價此頁

RReLU#

class torch.nn.modules.activation.RReLU(lower=0.125, upper=0.3333333333333333, inplace=False)[原始碼]#

逐元素應用隨機的 Leaky Rectified Linear Unit 函式。

方法描述於論文:《Convolutional Network 中 Rectified 啟用的經驗評估》

該函式定義為

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)[原始碼]#

執行前向傳播。

返回型別

張量