The batched index — per-example lifts and true batch-norm on Vec (N·a) #
A batch of N examples is laid out row-major [N, a]: example n is the finProdFinEquiv block
{(n, ·)}. batchMap N f lifts a per-example map across the batch, batchMapAux lifts one that
also reads each example's own saved value, and batchSlice N a v n reads example n back.
bnBatchLA is the one batch-coupled op: true batch-norm (bnBatchTensor4) at the network's
left-associated N·(c·h·w) index. None of this mentions the IR; StableHLO's batched nodes
denote these. The namespace is StableHLO for history, kept so every citation keeps its name.
Per-example block-apply. Lift a per-example map f : Vec a → Vec b to a
batch of N examples laid out row-major [N, a] ↦ [N, b] (the network's
[N,C,H,W]-style flattening): example n occupies the finProdFinEquiv
block {(n, ·)}. Every spatial/channel op in EfficientNet is batch-separable
and lifts this way; only true batch-norm (bnBatchTensor4) couples the batch.
Equations
- Proofs.StableHLO.batchMap N f x idx = f (fun (i : Fin a) => x (finProdFinEquiv ((finProdFinEquiv.symm idx).1, i))) (finProdFinEquiv.symm idx).2
Instances For
The n-th example's slice of a batch laid out row-major [N, a]. A shared
weight's batched gradient is the sum over n of the per-example gradient on
batchSlice n — the form the batched param-SGD dens take (so the §1 fold closes
via the per-example cert + sum-linearity).
Equations
- Proofs.StableHLO.batchSlice N a v n i = v (finProdFinEquiv (n, i))
Instances For
batchSlice of a batchMap is the lifted function at the slice — the lemma that peels a
per-example lift back off at one example.
Per-example block-apply with per-example AUXILIARY data. batchMap lifts one fixed
function across the batch; this lifts a family indexed by each example's own saved value —
example n is handed batchSlice n aux, not the whole aux and not example 0's.
Every batched backward that recomputes from a saved forward activation has this shape, and
that is exactly why such ops cannot be BatchableOp descriptors: a descriptor's
batchMap N (denOp op) would apply ONE example's saved value to all N. Cf. swishBackB,
sigmoidBackB, selectPosB (pointwise, so they take the whole-batch x directly) and
seBackBatched (which inlines this shape).
Equations
- One or more equations did not get rendered due to their size.
Instances For
True batch-norm at the network's left-assoc [N,C,H,W] flat index. The
proven bnBatchTensor4 (typed at N·(oc·(h·w))) conjugated by the mul_assoc
reindex so it slots into the N·(oc·h·w) batched composition (where conv/etc.
produce oc·h·w = (oc·h)·w). Reindex only — the function IS bnBatchTensor4.
Equations
Instances For
Pointwise maps are batchMap-free. Lifting an elementwise map across N examples IS the
elementwise map at the batched index N·n. This is why moving the pointwise nodes onto
descriptors was denotation-preserving, and it is the half of that claim the artifact cannot
witness: the render is value-independent, so a descriptor with the wrong den emits the same
bytes. Cf. swishBackB/sigmoidBackB, which are NOT descriptors precisely because their
backward is not of this shape — it reads a per-example saved activation.
batchMap of a continuous per-example op is continuous.