SiLU#
- class torch.nn.SiLU(inplace=False)[源代码]#
逐元素应用 Sigmoid 线性单元 (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)