評價此頁

torch.nn.functional.silu#

torch.nn.functional.silu(input, inplace=False)[原始碼]#

逐元素應用 Sigmoid Linear Unit (SiLU) 函式。

SiLU 函式也稱為 swish 函式。

silu(x)=xσ(x),where σ(x) is the logistic sigmoid.\text{silu}(x) = x * \sigma(x), \text{where } \sigma(x) \text{ is the logistic sigmoid.}

注意

請參閱 Gaussian Error Linear Units (GELUs),其中最初創造了 SiLU (Sigmoid Linear Unit) 一詞;以及參閱 Sigmoid-Weighted Linear Units for Neural Network Function Approximation in Reinforcement LearningSwish: a Self-Gated Activation Function,其中後來對 SiLU 進行了實驗。

有關更多詳細資訊,請參閱 SiLU

返回型別

張量