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)