Autograd node for the exact (Gaussian-CDF) GeLU .
Routed to by F.gelu(x, approximate="none"). Implementing this as a
dedicated op (instead of the prior ten-op Python composition built around
_erf_approx) lets the GPU backend dispatch to a single MPSGraph node
and keeps the autograd graph compact for memory accounting.
Math
\qquad \frac{\partial y}{\partial x} = \tfrac{1}{2}\,\Bigl(1 + \mathrm{erf}\bigl(\tfrac{x}{\sqrt{2}}\bigr)\Bigr) + \tfrac{x}{\sqrt{2\pi}}\,e^{-x^2/2}$$Attributes
schema_ v1OpSchema"gelu_exact", AmpPolicy::ForceFP32 — matches the tanh-approx variant for consistent AMP semantics across approximations.Static methods
1Methods
2Eager-mode backward: dispatches to IBackend::gelu_exact_backward.
Graph-mode backward: \Phi(x) + x\,\phi(x) built from erf and exp, both of which carry their own graph-mode formulas.