hawk.diff

hawk.diff#

IR -> IR autodiff, symbolic and in both directions. vjp() and jvp() synthesise a NEW IR from a primal one, driven by the per-node-KIND rule table (hawk.diff.rules); the result is an ordinary HAWK IR that goes through the same canonical walk, emitter and cache as any primal.

Functions

vjp(…)

The reverse-mode derivative IR of primal: one adjoint plane per primal sink in, one gradient plane per wrt input out.

jvp(…)

The forward-mode derivative IR of primal: one tangent plane per wrt input in, one directional-derivative sink per primal sink out.

Classes

Derived

The sink tuple vjp()/jvp() return, tagged with facts the transform already knows: which kernel it differentiated (primal, or None for an unnamed sink set), which direction (kind, "vjp"/"jvp"), with respect to which leaves (wrt, resolved names in traversal order) and which already-published unit the primal lives in (primal_unit, None meaning "same bundle as this derivative").