Chapter 4: CIFAR-10 2D CNN (no BatchNorm) — whole-network VJP #
The Chapter-4 demo model cifarCnn (the no-BN spec of MainCifarCnnTrain):
conv 3→32 (relu) → conv 32→32 (relu) → maxPool 2×2 → conv 32→64 (relu) → conv 64→64 (relu) → maxPool 2×2 → flatten → dense 4096→512 (relu) → dense 512→512 (relu) → dense 512→10
i.e. two conv→conv→maxPool stages (channels 3→32→32, then 32→64→64) and a three-layer dense head, on 32×32 RGB input with two 2×2 pools (32→16→8).
This is the Chapter-3 mnistCnnNoBn machinery scaled up: the same
convRelu/denseRelu/maxPoolFlat building blocks, chained through
vjp_comp_at, just longer and with two maxpool steps. Spatial bookkeeping
uses the final pooled size (h, w) as the unit: the second conv stage runs at
(2h, 2w), the first at (2·(2h), 2·(2w)) — exactly the Chapter-3 (2h, 2w)
convention nested one level deeper (so the two pools read maxPoolFlat _ (2h) (2w)
and maxPoolFlat _ h w).
cifarCnn_has_vjp_at— the structural whole-network VJP: the composed backward equals thepdiv-Jacobian VJP of the full forward pass, conditional on smoothness at the six ReLU kinks and the two MaxPools. The Chapter-4 sibling ofmnistCnnNoBn_has_vjp_at.Tiny.cifarTinyCnn_has_vjp_correct— a concrete instance where every smoothness hypothesis is discharged (positivity + positional injectivity through both pools), so the statement is unconditional and closes under the three-axiom kernel. The non-vacuity witness for the conditional capstone.
The Chapter-4 cifarCnn forward, in flattened Vec space. The conv stack
runs at spatial (2·(2h), 2·(2w)); the first maxPool halves it to
(2h, 2w) (where the second conv stage runs), the second to (h, w); then
three dense layers (two with ReLU). With the real CIFAR shapes
ic=3, c1=32, c2=64, h=w=8, d1=512, nClasses=10, kH=kW=3 the input width is
3·32·32 = 3072 and the flattened pool output is 64·8·8 = 4096.
Equations
- One or more equations did not get rendered due to their size.
Instances For
CIFAR 2D CNN (no BN) whole-network VJP at a smooth point.
The composed backward of the full Chapter-4 forward equals the
pdiv-contracted Jacobian, conditional on smoothness at the six ReLU kinks
and the two MaxPools. Built by vjp_comp_at through
convRelu → convRelu → maxPool → convRelu → convRelu → maxPool → denseRelu → denseRelu → dense. The Chapter-4 sibling of
mnistCnnNoBn_has_vjp_at (two conv stages, two pools).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Public correctness theorem for cifarCnn_has_vjp_at — the Chapter-4
CIFAR CNN's backward equals the pdiv-contracted Jacobian.
16 distinct positive values, 4×4 row-major ⇒ positionally injective. Typed
at the 2·(2·1) spatial form so it lines up syntactically with the forward's
stage-1 input shape (no 2*2 vs 2*(2*1) cast friction).
Equations
- Proofs.Tiny.T0 x✝ hi wi = ↑(4 * ↑hi + ↑wi + 1)
Instances For
Dense heads: nonnegative weights + a strictly-positive bias keep every activation off the ReLU kink.
Equations
- Proofs.Tiny.Wd5 x✝¹ x✝ = 1
Instances For
The second pool's input (= the first pool's output, post identity stage-2) is everywhere positive.
The four first-pool window maxima are 8·r + 2·s + 6 (i.e. 6,8,14,16):
T0 is strictly increasing in row-major, so each 2×2 window's max is its
bottom-right corner. Proved by folding the real maxes back through
Nat.cast_max and discharging the resulting Nat identity with omega.
Unconditional whole-network VJP for a concrete tiny CIFAR CNN. Every
smoothness hypothesis of cifarCnn_has_vjp_at is discharged — the two
no-tie conditions via positional injectivity (maxPool2Smooth_of_injective,
the second through pool1_inj), the six ReLU conditions via positivity —
so the statement carries no side conditions and stays in the three-axiom
closure.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The deeper (8-conv) CIFAR forward, flattened. Four conv→conv→pool stages
(ic→c1→c1, c1→c2→c2, c2→c3→c3, c3→c4→c4) then dense 3-head.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Deeper (8-conv) CIFAR CNN (no BN) whole-network VJP at a smooth point.
Conditional on the twelve ReLU smoothness kinks and the four MaxPools; built by
vjp_comp_at through convRelu×8 / maxPool×4 / denseRelu×2 / dense. The
4-stage sibling of cifarCnn_has_vjp_at. The smoothness side conditions are
supplied opaquely (hf1 … hf12, hp1 … hp4) — they discharge for a concrete
instance the same way Tiny.cifarTinyCnn_has_vjp_at discharges the 2-stage ones.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Public correctness theorem for cifarCnn8_has_vjp_at — backward equals the
pdiv-contracted Jacobian.
conv → per-channel-BN → relu block VJP at a smooth point. The per-channel
(bnPerChannelTensor3, m=h·w) sibling of convBnRelu_has_vjp_at: the same two
vjp_comp_at chain with bnPerChannelTensor3 (vector γ/β [oc], its own
block-diagonal VJP) in place of the scalar-global bnForward.
Equations
- One or more equations did not get rendered due to their size.
Instances For
conv → per-channel-BN → relu is differentiable at a smooth point.
The Chapter-4 BatchNorm CIFAR forward: cifarCnnForward with a per-example
per-channel bnPerChannelTensor3 (m=h·w) inserted between each conv and its
ReLU (four BN layers, scalar εᵢ, per-channel vector γᵢ, βᵢ : Vec cᵢ).
Equations
- One or more equations did not get rendered due to their size.
Instances For
BN-CIFAR whole-network VJP at a (post-BN) smooth point. The composed
backward equals the pdiv-contracted Jacobian, conditional on 0 < εᵢ and
smoothness at the six ReLU kinks (now reading the post-BN pre-activations)
and the two MaxPools. Chains convBnRelu → convBnRelu → maxPool → convBnRelu → convBnRelu → maxPool → denseRelu → denseRelu → dense through
vjp_comp_at. The BatchNorm sibling of cifarCnn_has_vjp_at.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Public correctness theorem for cifarCnnBn_has_vjp_at — the BN-CIFAR
CNN's backward equals the pdiv-contracted Jacobian.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.