捷徑

SELU

class torch.nn.SELU(inplace=False)[來源][來源]

逐元素套用 SELU 函數。

SELU(x)=scale(max(0,x)+min(0,α(exp(x)1)))\text{SELU}(x) = \text{scale} * (\max(0,x) + \min(0, \alpha * (\exp(x) - 1)))

其中 α=1.6732632423543772848170429916717\alpha = 1.6732632423543772848170429916717scale=1.0507009873554804934193349852946\text{scale} = 1.0507009873554804934193349852946

警告

當使用 kaiming_normalkaiming_normal_ 進行初始化時,為了獲得自正規化神經網路,應該使用 nonlinearity='linear',而不是 nonlinearity='selu'。詳情請參考 torch.nn.init.calculate_gain()

更多細節請參考論文 Self-Normalizing Neural Networks

參數

inplace (bool, optional) – 是否選擇性地進行原地 (in-place) 操作。預設值:False

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

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

../_images/SELU.png

範例

>>> m = nn.SELU()
>>> input = torch.randn(2)
>>> output = m(input)

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

取得為初學者和進階開發人員提供的深入教學

檢視教學

資源

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

檢視資源