Skip to content
class

ErfinvBackward

ErfinvBackward

Python wrappers

Public Python APIs implemented by this engine symbol.

Autograd node for the element-wise inverse error function y=erfinv(x)y = \mathrm{erfinv}(x).

Saves the output yy so the backward pass can form ey2e^{y^2} without needing to invert erf\mathrm{erf} a second time. Defined on (−1,1)(-1, 1); the gradient is unbounded as x→±1x \to \pm 1.

Math

\frac{\partial y}{\partial x} = \frac{\sqrt{\pi}}{2}\,e^{y^2}, \qquad \frac{\partial \mathcal{L}}{\partial x} = \frac{\sqrt{\pi}}{2}\,e^{y^2}\,\frac{\partial \mathcal{L}}{\partial y}.$$

Attributes

schema_v1OpSchema
Registered as "erfinv" with AmpPolicy::Promote.
kSavesInputbool
false.
kSavesOutputbool
true — saved tensor is y=erfinv(x)y = \mathrm{erfinv}(x).

Notes

Dispatch: Accelerate erfinv kernel (CPU) / MLX erfinv (GPU).

Static methods

1
static

dispatch

int dispatch(backend::IBackend & be, const int & a, const int & shape, Dtype dt)

Forward — calls IBackend::erfinv to compute y=erfinv(x)y = \mathrm{erfinv}(x).

Methods

2
fn

grad_formula

int grad_formula(const int & g)

Backward — ∂y/∂x=π2 ey2\partial y/\partial x = \tfrac{\sqrt{\pi}}{2}\,e^{y^2}, scaled by grad_out.

fn

grad_formula_impl

int grad_formula_impl(const int & g, const int &, const int & out)

Graph-mode backward: ∂x=π2 eout2 g\partial x = \tfrac{\sqrt{\pi}}{2}\,e^{\mathrm{out}^2}\,g using the saved output, kept inside the autograd graph.