Skip to main content

Mojo function

gelu

gelu(value: Symbol) -> Symbol

Computes the elementwise gelu function of a symbolic tensor.

Creates a new op node to compute the elementwise gelu function of a symbolic tensor and adds it to the graph, returning the symbolic result.

gelu is defined as gelu(x)=xΦ(x)gelu(x) = x \Phi(x) where Φ\Phi is the cumulative distribution function of the Gaussian distribution. See the paper for more details.

Args:

  • value (Symbol): The symbolic tensor to use as the input to the gelu function computation.

Returns:

A new symbolic tensor value representing the output of the absolute value computation.

Raises:

If the symbol doesn't represent a tensor value.