GELU¶
- class torch.nn.GELU(approximate='none')[来源][来源] ¶
应用高斯误差线性单元函数。
其中 是高斯分布的累积分布函数。
当近似参数为‘tanh’时,Gelu 的估计方法为:
- 参数:
近似(str,可选)- 要使用的 Gelu 近似算法:
'none'
|'tanh'
。默认:'none'
- 形状:
输入: ,其中 表示任意数量的维度。
输出: ,与输入具有相同的形状。
示例:
>>> m = nn.GELU() >>> input = torch.randn(2) >>> output = m(input)