r34 Item A — the PER-CHANNEL-BN ResNet-34 forward graph (matches the render) #
The ResNet-34 peer of MobileNetV2RenderPC.lean. StableHLO.lean's resnetFwdGraph is a
representative (stem + 1 identity + 1 projection block + GAP + dense) using scalar bnF; the
operational render (tests/TestResnet34Train.lean) emits per-channel BN, the full 16-block
[3,4,6,3] net, a 7×7 strided stem and a maxpool. This file is the per-channel twin matching the
render:
- per-channel building blocks
cbrStridedPC(7×7 strided stem conv→bn→relu),rblkPC(identity basic blockrelu(F(x)+x)),rblkPStridedPC(downsample basic blockrelu(F_s(x)+proj_s(x)), with the 1×1 strided option-B projection skip) — per-channelbnPerChannelTensor3mirrors ofcbr/rblk/rblkP(CNN.lean). - per-block typed
SHlographsidBlockGraphPC/downBlockGraphPC+ their_faithfullemmas (den (block graph) = block forward (den input)), viabnPerChannelF_faithful/reluF_faithful/flatConv(Strided)F_faithful/den_addV. The residual skip reuses the block-input subtree in bothaddVoperands (tree-safe), as inresnetFwdGraph.
Part 2 (below) chains these into the full resnet34FwdGraphFullPC + resnet34Forward_full_pc +
faithfulness at the render dims (3×224² → 7×7×512). Prerequisite for the structured render (Item B).
No new tokens. 3-axiom clean.
7×7 strided stem conv → bn → relu, per-channel BN.
Equations
- Proofs.cbrStridedPC W b ε γ β = Proofs.relu (oc * h * w) ∘ Proofs.bnPerChannelTensor3 oc h w ε γ β ∘ Proofs.flatConvStride2 W b
Instances For
Identity basic block relu(F(x) + x), F = (bn∘conv) ∘ (relu∘bn∘conv), per-channel BN.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Downsample basic block relu(F_s(x) + proj_s(x)): body bn∘conv ∘ relu∘bn∘conv_strided
(ic→oc, halves spatial), projection bn∘conv_strided (1×1 stride-2 option-B skip). Per-channel BN.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Identity-block ℝ-forward at shared ε (the partial application rblkPC takes).
Equations
- Proofs.idFwd ε W₁ b₁ γ₁ β₁ W₂ b₂ γ₂ β₂ = Proofs.rblkPC W₁ b₁ ε γ₁ β₁ W₂ b₂ ε γ₂ β₂
Instances For
Downsample-block ℝ-forward at shared ε.
kHp kWp is the projection kernel and is generic; the body convs stay 3×3, which is what
He et al. specify. It was pinned at 3×3 here until 2026-07-30, when §2k found the render's
projection is a 3×3 where the paper's option-B shortcut is 1×1 — the whole point of the binder
is that switching the two is an argument, not a proof edit.
Equations
- Proofs.downFwd ε W₁ b₁ γ₁ β₁ W₂ b₂ γ₂ β₂ Wp bp γp βp = Proofs.rblkPStridedPC W₁ b₁ ε γ₁ β₁ W₂ b₂ ε γ₂ β₂ Wp bp ε γp βp
Instances For
The full per-channel ResNet-34 forward (render dims 3×224² → 7×7×512).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Identity-block forward graph: relu(addV(bn∘conv∘relu∘bn∘conv, skip)); the skip reuses the
block-input subtree e.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Downsample-block forward graph: relu(addV(body, projection)), body strided conv1 + conv2,
projection a kHp×kWp strided conv; both read the block-input subtree e.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Identity block faithfulness. den (idBlockGraphPC … e) = rblkPC … (den e).
Downsample block faithfulness. den (downBlockGraphPC … e) = rblkPStridedPC … (den e).
Whole per-channel-BN ResNet-34 forward graph at the render dims (3×224² → 7×7×512): 7×7
strided stem (flatConvStridedF) → bn → relu → maxPoolF → [3,4,6,3] basic blocks (each via
idBlockGraphPC/downBlockGraphPC) → GAP → dense. Per-channel BN throughout, matching the
render. The per-channel twin of resnetFwdGraph, at full depth.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full per-channel-BN ResNet-34 forward faithfulness. den (resnet34FwdGraphFullPC …) = resnet34Forward_full_pc …, chaining the per-block faithful lemmas + stem/maxpool/GAP/dense. The
"text = render of a proven graph" forward half at the render's per-channel BN.