快捷方式

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 的全面開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源