Skip to content
class

AtanBackward

AtanBackward

Python wrappers

Public Python APIs implemented by this engine symbol.

Autograd node for element-wise arctangent y=arctan⁡(x)y = \arctan(x).

Saves the input x so the backward pass can compute the denominator 1+x21 + x^2. Defined on all of R\mathbb{R} with range (−π2,π2)(-\tfrac{\pi}{2}, \tfrac{\pi}{2}) and a smooth, bounded gradient.

Math

\frac{\partial y}{\partial x} = \frac{1}{1 + x^2}, \qquad \frac{\partial \mathcal{L}}{\partial x} = \frac{1}{1 + x^2}\,\frac{\partial \mathcal{L}}{\partial y}.$$

Attributes

schema_v1OpSchema
Registered as "arctan" with AmpPolicy::Promote.

Notes

Dispatch: Accelerate vvatanf/vvatan (CPU) / MLX arctan (GPU).

Static methods

1
static

dispatch

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

Forward — calls IBackend::atan to compute y=arctan⁡xy = \arctan x.

Methods

2
fn

grad_formula

int grad_formula(const int & g)

Backward — ∂y/∂x=1/(1+x2)\partial y/\partial x = 1/(1 + x^2), scaled by grad_out.

fn

grad_formula_impl

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

Graph-mode backward: the same derivative built from composable ops, so the gradient itself stays differentiable.