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)