评价此页

torch.nn.functional.silu#

torch.nn.functional.silu(input, inplace=False)[source]#

逐元素应用 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

返回类型

张量