SiLU#
- class torch.nn.modules.activation.SiLU(inplace=False)[source]#
逐元素應用 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)