nnf_gelu function

Gelu

Gelu

nnf_gelu(input, approximate = "none")

Arguments

  • input: (N,*) tensor, where * means, any number of additional dimensions
  • approximate: By default it's none, and applies element-wise x*pnorm(x), if 'tanh', then GELU is estimated. See GELU for more info.

gelu(input) -> Tensor

Applies element-wise the function GELU(x)=xΦ(x)GELU(x) = x * \Phi(x)

where Φ(x)\Phi(x) is the Cumulative Distribution Function for Gaussian Distribution.

See Gaussian Error Linear Units (GELUs).

  • Maintainer: Daniel Falbel
  • License: MIT + file LICENSE
  • Last published: 2025-02-14