SiLU¶
- class torch.nn.SiLU(inplace=False)[来源][来源]¶
逐元素地应用 Sigmoid Linear Unit (SiLU) 函数。
SiLU 函数也称为 swish 函数。
注意
请参阅 Gaussian Error Linear Units (GELUs),其中最初提出了 SiLU(Sigmoid Linear Unit),并参阅 Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement Learning 和 Swish: a Self-Gated Activation Function,其中 SiLU 在后期进行了实验。
- 形状
输入: ,其中 表示任意数量的维度。
输出: ,与输入形状相同。
示例
>>> m = nn.SiLU() >>> input = torch.randn(2) >>> output = m(input)