GELU¶
- class torch.nn.GELU(approximate='none')[來源][來源]¶
套用 Gaussian Error Linear Units 函數。
其中 是高斯分佈的累積分布函數 (Cumulative Distribution Function)。
當 approximate 引數為 ‘tanh’ 時,Gelu 會使用以下方式估算:
- 參數
approximate (str, optional) – 要使用的 gelu 近似演算法:
'none'
|'tanh'
。 預設值:'none'
- 形狀
輸入: , 其中 表示任意數量的維度。
輸出: , 與輸入相同的形狀。
範例
>>> m = nn.GELU() >>> input = torch.randn(2) >>> output = m(input)