ForwardScale #
Forward scale propagation over SSA/DAG graphs.
This optional module mirrors NN.Proofs.RuntimeApprox.Graph.ForwardApprox, but for scale bounds
(nonnegative bounds on linf_norm) rather than eps error bounds.
PyTorch analogue: users often track activation magnitudes (for normalization, stability, or analysis). Here we make that tracking explicit and compositional at the proof level.
A forward node augmented with a scale bound function and a soundness lemma.
- forwardRuntime : TList α Γ → Spec.Tensor α τ
- bound : EList Γ → TList α Γ → Spec.SpecScalar
- sound (xS : TList Spec.SpecScalar Γ) (xR : TList α Γ) (eps : EList Γ) : approxCtx toSpec xS xR eps → approxT toSpec (self.forwardSpec xS) (self.forwardRuntime xR) (self.bound eps xR)
- scaleSound (ctxS : TList Spec.SpecScalar Γ) (ctxR : TList α Γ) (epsCtx : EList Γ) (bCtx : BList Γ) : approxCtx toSpec ctxS ctxR epsCtx → scaleCtx toSpec ctxS ctxR bCtx → scaleT toSpec (self.forwardSpec ctxS) (self.forwardRuntime ctxR) (self.scaleBound bCtx ctxR)
Instances For
Forward graph with scale-aware nodes.
- nil {α : Type} {toSpec : α → Spec.SpecScalar} {Γ : List Spec.Shape} : FwdGraphScale toSpec Γ []
- snoc {α : Type} {toSpec : α → Spec.SpecScalar} {Γ ss : List Spec.Shape} {τ : Spec.Shape} : FwdGraphScale toSpec Γ ss → FwdNodeScale toSpec (Γ ++ ss) τ → FwdGraphScale toSpec Γ (ss ++ [τ])
Instances For
Forget the scale annotations on nodes, producing an ordinary FwdGraph.
Instances For
Evaluate the forward pass on spec values, returning the extended context Γ ++ ss.
Instances For
Evaluate the forward pass on runtime values, returning the extended context Γ ++ ss.
Instances For
Forward-pass error bounds for all intermediate nodes, computed from input bounds epsIn.
Instances For
Forward-pass scale bounds for all intermediate nodes, computed from input bounds bIn.