Skip to main content

gelu

Function gelu 

pub fn gelu<const D: usize>(tensor: Tensor<D>) -> Tensor<D>
Expand description

Applies the Gaussian Error Linear Units function as described in the paper Gaussian Error Linear Units (GELUs).

GELU(x) = x * Φ(x) = x * 1/2 * (1 + erf(x / sqrt(2)))

where Φ(x) is the cumulative distribution function for the Gaussian distribution.