Link Proofs.RuntimeApprox.RevGraph to the executable Proofs.Autograd.Algebra.GraphData #
This is a definitional/structural bridge:
RevGraph.toGraphDataerases spec/bound metadata and keeps the runtime forward/VJP closures.- We show
GraphData.eval/GraphData.backpropCtxcoincide withRevGraph.evalRuntime/RevGraph.backpropRuntime.
Both sides use TorchLean.TensorPack directly, so the bridge does not convert between
different context representations.
Only forward evaluation and reverse accumulation are preserved. The required NodeData.jvp
field is filled with the forward map, independent of its tangent argument: it is not a derivative
and must not be used for forward-mode differentiation. This bridge also does not establish native
kernel correspondence or that the supplied reverse maps are derivatives.
Note on environments (Δ):
Proofs.Autograd.Algebra.GraphData is parameterized by an extra (non-differentiable) environment
Δ threaded through evaluation. The runtime-approximation graphs here do not use such an
environment, so we instantiate the executable layer at Δ := Unit and pass () during
evaluation/backprop.
Erase a RuntimeApprox.RevNode into an executable Autograd.Algebra.NodeData.
We take Δ := Unit (no extra environment). The JVP field repeats the forward map as a
placeholder; only forward evaluation and VJP-based backprop are supported by this conversion.
Instances For
Erase a RuntimeApprox.RevGraph into executable Autograd.Algebra.GraphData (with Δ := Unit).
This forgets all spec/bound metadata and keeps only the runtime forward and vjp closures.
Instances For
Erasing a RevGraph into executable GraphData preserves the runtime forward semantics.
Informally: if you forget the spec and bound metadata and keep only the runtime closures, you still evaluate to the same runtime context.
Erasing a RevGraph into executable GraphData preserves the runtime backward semantics.
Informally: the executable GraphData.backpropCtx computes the same reverse-mode accumulation as
RevGraph.backpropRuntime when given the same runtime input context and seed cotangents.