GELU¶
- class torch.nn.GELU(approximate='none')[源代码][源代码]¶
应用 Gaussian Error Linear Units 函数。
其中 是高斯分布的累积分布函数。
当 approximate 参数为 ‘tanh’ 时,Gelu 使用以下公式估算:
- 参数
approximate (str, 可选) – 要使用的 gelu 近似算法:
'none'
|'tanh'
。默认值:'none'
- 形状
输入: ,其中 表示任意数量的维度。
输出: ,与输入形状相同。
示例
>>> m = nn.GELU() >>> input = torch.randn(2) >>> output = m(input)