捷徑

RReLU

class torch.nn.RReLU(lower=0.125, upper=0.3333333333333333, inplace=False)[source][source]

逐元素地套用隨機洩漏修正線性單元函數(randomized leaky rectified linear unit function)。

此方法描述於論文: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) – 可選擇是否原地 (in-place) 執行操作。預設值: False

形狀 (Shape)
  • 輸入: ()(*),其中 * 代表任意數量的維度。

  • 輸出: ()(*),與輸入形狀相同。

../_images/RReLU.png

範例

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

文件

取得 PyTorch 完整的開發者文件

檢視文件

教學

取得適合初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並獲得您的問題解答

檢視資源