GELU¶
- class torch.nn.GELU(approximate='none')[source][source]¶
應用高斯誤差線性單元函式。
其中 是高斯分佈的累積分佈函式。
當 approximate 引數為 ‘tanh’ 時,Gelu 使用以下公式估計:
- 引數
approximate (str, optional) – 要使用 gelu 近似演算法:
'none'|'tanh'。預設值:'none'
- 形狀
輸入: , 其中 表示任意數量的維度。
輸出: , 形狀與輸入相同。
示例
>>> m = nn.GELU() >>> input = torch.randn(2) >>> output = m(input)