All formulas

Machine learning building blocks

SiLU (swish)

ml.siluAlso called silu, swish, sigmoid linear unit, swish1

SiLU⁡(x)=x1+e−x\operatorname{SiLU}(x) = \frac{x}{1 + e^{-x}}

x times its logistic sigmoid, x σ(x). Swish with β = 1.

Notation

xx

input

x ∈ ℝ

SiLU⁡(x)\operatorname{SiLU}(x)

Result: the activation

scalar

Worked examples

Each result is solved exactly and confirmed by two independent computations.

  1. Given

    x=0x = 0

    Result

    SiLU⁡(x)=0\displaystyle \operatorname{SiLU}(x) = 0
  2. Given

    x=1x = 1

    Result

    SiLU⁡(x)=1e−1+1\displaystyle \operatorname{SiLU}(x) = \frac{1}{e^{-1} + 1}

    ≈ 0.73105857863

  3. Given

    x=−1x = -1

    Result

    SiLU⁡(x)=−11+e\displaystyle \operatorname{SiLU}(x) = - \frac{1}{1 + e}

    ≈ -0.26894142137

  4. Given

    x=2x = 2

    Result

    SiLU⁡(x)=2e−2+1\displaystyle \operatorname{SiLU}(x) = \frac{2}{e^{-2} + 1}

    ≈ 1.76159415596

Common mistakes

  • Returns σ(x) without the factor x

    The gate σ(x) is returned instead of x σ(x).

    Fix: Multiply the sigmoid by x.

Sources

  • Elfwing et al. 2018

    Elfwing, Stefan; Uchibe, Eiji; Doya, Kenji. Sigmoid-weighted linear units for neural network function approximation in reinforcement learning. Neural Networks 107: 3-11, 2018. doi:10.1016/j.neunet.2017.12.012

    doi.org
  • Hendrycks and Gimpel 2016

    Hendrycks, Dan; Gimpel, Kevin. Gaussian Error Linear Units (GELUs). arXiv:1606.08415, 2016.

    arxiv.org