Skip to content
class

AbsBackward

AbsBackward

Python wrappers

Public Python APIs implemented by this engine symbol.

Static methods

1
static

dispatch

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

Forward — calls IBackend::abs to compute y=∣x∣y = |x|.

Methods

2
fn

grad_formula

int grad_formula(const int & g)

Backward — ∂y/∂x=sign(x)\partial y/\partial x = \mathrm{sign}(x), 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.