Batched stages — conv/depthwise → true batch-norm (→ swish) at the batched index, with VJPs #
The building blocks every batched conv-net forward is written in, at the flat batched index
N·(c·h·w): each stage is batchMap N of a proven per-example op, then true batch-norm
(bnBatchLA, which couples the batch), then pointwise swish where the net has it.
| stage | forward | VJP |
|---|---|---|
| 1×1 / stride-1 conv → BN → swish | cbsB | cbsB_has_vjp |
XLA-SAME stride-2 stem conv → BN → swish | stemB | stemB_has_vjp |
| depthwise (stride 1 / symmetric stride 2) → BN → swish | dwbsB / dwbsSB | dwbsB_has_vjp / dwbsSB_has_vjp |
| squeeze-excite | seB | seB_has_vjp |
| 1×1 projection → BN (no activation) | projB | projB_has_vjp |
The generic pieces they compose — batchMap_has_vjp (block-diagonal VJP of a batch-separable op)
and bnBatchLA_has_vjp — are in BatchMapVJPAt. EfficientNet-B0, MobileNetV2/V4 and the ResNets
build their blocks from these; the MBConv blocks themselves are in EfficientNetRenderPC and
EfficientNetChainClose.
Batched conv → bn → swish (1×1 expand / generic stride-1 conv).
Equations
- Proofs.cbsB N W b ε γ β = Proofs.swish (N * (oc * h * w)) ∘ Proofs.StableHLO.bnBatchLA N oc h w ε γ β ∘ Proofs.StableHLO.batchMap N (Proofs.flatConv W b)
Instances For
Batched strided (3×3 s2) stem conv → bn → swish (halves spatial). ⚠ At the XLA-SAME phase
(flatConvStride2Xla = decimateOddFlat ∘ flatConv): the TF-origin B0 pads its stem (0,1),
and the shipped render has emitted convStridedXla there since 2026-08-08. The symmetric
flatConvStride2 has the same type and output shape; nothing structural would notice the
wrong one (re-spelled 2026-09-05, planning/archive/xla_same_respell_and_blueprint_audit.md).
Equations
- Proofs.stemB N W b ε γ β = Proofs.swish (N * (oc * h * w)) ∘ Proofs.StableHLO.bnBatchLA N oc h w ε γ β ∘ Proofs.StableHLO.batchMap N (Proofs.flatConvStride2Xla W b)
Instances For
Batched depthwise (stride-1, k×k) → bn → swish.
Equations
- Proofs.dwbsB N W b ε γ β = Proofs.swish (N * (c * h * w)) ∘ Proofs.StableHLO.bnBatchLA N c h w ε γ β ∘ Proofs.StableHLO.batchMap N (Proofs.depthwiseFlat W b)
Instances For
Batched depthwise (stride-2 downsample, k×k) → bn → swish.
Equations
- Proofs.dwbsSB N W b ε γ β = Proofs.swish (N * (c * h * w)) ∘ Proofs.StableHLO.bnBatchLA N c h w ε γ β ∘ Proofs.StableHLO.batchMap N (Proofs.depthwiseStride2Flat W b)
Instances For
Batched squeeze-excite block x ⊙ gate(x) (the proven seBlockFull, per example).
Equations
- Proofs.seB N W₁ b₁ W₂ b₂ = Proofs.StableHLO.batchMap N (Proofs.seBlockFull W₁ b₁ W₂ b₂)
Instances For
Batched project: 1×1 conv → bn (no swish — the linear bottleneck).
Equations
- Proofs.projB N W b ε γ β = Proofs.StableHLO.bnBatchLA N oc h w ε γ β ∘ Proofs.StableHLO.batchMap N (Proofs.flatConv W b)
Instances For
flatConv W b VJP — the per-example 1×1/3×3 conv input-VJP (the HasVJP3-bridged conv2d).
Equations
Instances For
Differentiability of a batched conv/depthwise → bn → swish stage.
VJP of a batched conv/depthwise → bn → swish stage: lift op's VJP per example, then the proven
true-BN VJP, then the pointwise swish VJP.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Differentiability of a batched conv → bn stage (project bottleneck, no swish).
VJP of a batched conv → bn stage.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Proofs.cbsB_has_vjp N W b ε hε γ β = Proofs.bnSwishStage_has_vjp N (Proofs.flatConv W b) ⋯ (Proofs.flatConv_has_vjp W b) ε hε γ β
Instances For
Equations
- Proofs.stemB_has_vjp N W b ε hε γ β = Proofs.bnSwishStage_has_vjp N (Proofs.flatConvStride2Xla W b) ⋯ (Proofs.flatConvStride2Xla_has_vjp W b) ε hε γ β
Instances For
Equations
- Proofs.dwbsB_has_vjp N W b ε hε γ β = Proofs.bnSwishStage_has_vjp N (Proofs.depthwiseFlat W b) ⋯ (Proofs.depthwiseFlat_has_vjp W b) ε hε γ β
Instances For
Equations
- Proofs.dwbsSB_has_vjp N W b ε hε γ β = Proofs.bnSwishStage_has_vjp N (Proofs.depthwiseStride2Flat W b) ⋯ (Proofs.depthwiseStride2Flat_has_vjp W b) ε hε γ β
Instances For
Equations
- Proofs.seB_has_vjp N W₁ b₁ W₂ b₂ = Proofs.batchMap_has_vjp (Proofs.seBlockFull W₁ b₁ W₂ b₂) (Proofs.seBlockFull_has_vjp W₁ b₁ W₂ b₂) ⋯
Instances For
Equations
- Proofs.projB_has_vjp N W b ε hε γ β = Proofs.bnStage_has_vjp N (Proofs.flatConv W b) ⋯ (Proofs.flatConv_has_vjp W b) ε hε γ β