r50InputGradB IS the certified whole-net ResNet-50 gradient #
The whole-net input-gradient tie for resnet50ForwardBFull, the [3,4,6,3] bottleneck ladder at
batch BatchNorm, at a variable batch N and resolution q. The parameter-gradient tie is
ResNet50StepTieB's.
Almost all of it is ResNet-34's, reused rather than rewritten #
resnet50ForwardBFull is r34HeadB ∘ [3,4,6,3] bottlenecks ∘ r34StemB — the stem and head are
literally ResNet-34's functions at R50's widths — so ResNet34BackCertifiedTieB supplies:
cbReluStridedBBack_eq_vjp_backwardandr34HeadBBack_eq_vjp_backward, the two endpoint ties;maxPool3s2FlatBackBand itsrfltie, plus theStableHLO.batchMapAuxlift the batched 3×3/s2 pool needed;opaqueA0 … A16andr34BFullHasVJPAtitself — the generic eighteen-stage apex. [3,4,6,3] is sixteen blocks for both nets, so the chain is the same construction and a second copy would be two writers for one fact. It is ResNet-34's only by where it was written; every dimension in it is a variable. The prefixes themselves areFoundation/OpaquePrefix.lean's.
What this file adds is the sixteen bottleneck slots, the tie, its pdiv reading, and the shape
check resnet50ForwardBFull_eq_slots.
The two things ResNet-34's file did not face #
q is a BINDER. One statement covers resnet50in_fwd (q = 7, 224 px) and
resnet50in160_fwd (q = 5, 160 px). So every dimension is
an explicit 2 * (…) nest rather than 8 * q: those are equal Nats and NOT definitionally equal
terms at a variable q.
Scope #
A smooth-point statement: the tie assumes 0 < εs, the stem relu clause (h_stem) and
the stem pool's per-example condition (h_pool), and takes each of the sixteen bottlenecks as an
opaque HasVJPDiffAt witness at its running activation (a bottleneck's three relu clauses — the
two interior ones and the post-residual outer one — are the caller's, inside that witness).
One device: every ResNet-50 data-parallel render synchronises BatchNorm, and its step is
ResNet50SyncStepTieB's. It is about the INPUT gradient; the 161 parameter gradients are
ResNet50StepTieB.lean's tie.
This statement takes no precision flag. The ImageNet runs the book reports train from
resnet50in_momdp64bf16 and resnet50in160_lambaccdp4x128wxclipbcebf16, whose conv weight
gradients are the bf16 kinds (Foundation.Bf16GradNodes); those runs' steps are
ResNet50StepTieB's and, data-parallel, ResNet50SyncStepTieB's, both stated on the renderers'
bf16 switch at the identity rounding (Bf16Erasure).
r50InputGradB IS the certified whole-net ResNet-50 gradient. The committed backward
chain, with its stem BatchNorm and relu-mask slots filled by the certified per-op backwards,
its saved pool activation the stem's own, and its sixteen bottlenecks left OPAQUE, equals the
backward of r34BFullHasVJPAt at those eighteen stages. unfold, two rws, rfl — the
pool needs no rewrite, being definitionally batchMapHasVJPAt's backward.
The chain IS the pdiv-contracted Jacobian of the eighteen-stage net — at every batch
size, resolution q, loss cotangent and input pixel, at any input x where the
stem relu is off its kink (h_stem) and no stem-pool window ties (h_pool), for any block maps
b1 … b16 carrying HasVJPDiffAt witnesses at their running activations (hb1 … hb16), with
0 < εs. The tie above read through the apex's own .correct;
resnet50ForwardBFull_eq_slots below identifies those eighteen stages with the committed
forward.
THE SHAPE CHECK — the eighteen slots the tie is about ARE the committed forward.
resnet50ForwardBFull, regrouped into exactly the eighteen arguments r34BFullHasVJPAt
takes: ResNet-34's stem, the [3,4,6,3] bottleneck ladder as one stride-1 projection block
(s1b0, the form with no ResNet-34 analogue), three strided projections and twelve identity
bottlenecks, and ResNet-34's head.
The tie keeps its blocks opaque, so its subject is a chain of VARIABLES and nothing in it says
which net they are; this theorem says it. q is a binder here too, so it checks both shipped
resolutions.