R4 — printer faithfulness, Stage A (Chapter 1: the linear classifier) #
The seed of planning/archive/validated_codegen_book.md's Proofs/Hlo/{Syntax,Denote}.
IR.lean gives the backward/forward IR a denotation in ℝ and proves it equals
the Mathlib-fderiv math. The remaining trusted link — R4 — is that the
StableHLO text the printer emits means the same function. This file closes
R4 for Chapter 1, both halves, over a single typed AST SHlo:
Semantic half (
den, load-bearing): a denotation in StableHLO-spec terms (explicit contraction / reduce / divide), and faithfulness theoremsden (emit …) = <proven math>for every piece of the linear train step — forward logits, dense input-VJP, softmax-CE cotangent (to the proven ∂CE/∂logits), the weight/bias parameter Jacobians, and the SGD update (θ' = θ − lr·∇, now proven rather than trusted).Syntactic half (
pretty): the sameSHlocarries SSA-name annotations (denotation-irrelevant —denignores them) so it renders to real StableHLO text. The emitted modules — including the whole@linear_train_step— arepretty (emit g)(the doc's "Step 0 consolidation": one AST, both denotable and renderable).
All together (the R4 chain for ch 1):
render text = pretty (emit g) (syntactic, by construction);
den (emit g) = Mathlib fderiv (semantic, the theorems below).
Scope / residue. Per-example semantics (Vec/Mat): the batch axis is an
outer map, a printer concern (the doc's "D1 shortcut"). pretty's lexical
conformance to the StableHLO spec is the audited/validated residue (the doc's
"4b": cross-checked by iree-compile + execution — the verified-rendered train
step trains MNIST to ~92%), not a verified parse round-trip ("4a"). Everything
here closes under [propext, Classical.choice, Quot.sound] (tests/AuditAxioms.lean).
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
A batch-separable EfficientNet op, shape-indexed by per-example in/out
length. The descriptor carried by SHlo.batchOp; its denOp is the proven
per-example forward, lifted by batchMap.
On the pointwise ops. An earlier note here said swish/sigmoid/relu/addV
"need no descriptor — the existing tokens already denote them block-diagonally
at the batched index N·(c·h·w)". The denotation half of that is true and the
emit half is false, and the difference is what pinned the batched renderers at
N := 1. SHlo.swishF's token carries only the SHlo index n and emits
tensor<B×n>, i.e. it reads the index as a PER-EXAMPLE width; a descriptor-less
pointwise node at the batched index N·s therefore emits tensor<B×(N·s)>,
which does not even typecheck against its own operand. Giving the pointwise ops
descriptors separates the two numbers — N (batch, denotation) from n
(per-example width, emit) — which is what lets a whole graph sit at N := B
where the batch-coupled dens (bnBatchF, the *SgdB family) are honest.
The per-example renderers keep the descriptor-less tokens unchanged.
- conv {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * h * w) (oc * h * w)
- convStrided {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * (2 * h) * (2 * w)) (oc * h * w)
- convBf16 {ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * h * w) (oc * h * w)
- convF8 {ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * h * w) (oc * h * w)
- convStridedBf16 {ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * (2 * h) * (2 * w)) (oc * h * w)
- convStridedXla {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * (2 * h) * (2 * w)) (oc * h * w)
- convStridedXlaBf16 {ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * (2 * h) * (2 * w)) (oc * h * w)
- depthwise {c h w kH kW : ℕ} (wName bName : String) (W : DepthwiseKernel c kH kW) (bias : Vec c) : BatchableOp (c * h * w) (c * h * w)
- depthwiseBf16 {c h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : DepthwiseKernel c kH kW) (bias : Vec c) : BatchableOp (c * h * w) (c * h * w)
- depthwiseStridedXla {c h w kH kW : ℕ} (wName bName : String) (W : DepthwiseKernel c kH kW) (bias : Vec c) : BatchableOp (c * (2 * h) * (2 * w)) (c * h * w)
- depthwiseStridedXlaBf16 {c h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : DepthwiseKernel c kH kW) (bias : Vec c) : BatchableOp (c * (2 * h) * (2 * w)) (c * h * w)
- depthwiseStrided {c h w kH kW : ℕ} (wName bName : String) (W : DepthwiseKernel c kH kW) (bias : Vec c) : BatchableOp (c * (2 * h) * (2 * w)) (c * h * w)
- depthwiseStridedBf16 {c h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : DepthwiseKernel c kH kW) (bias : Vec c) : BatchableOp (c * (2 * h) * (2 * w)) (c * h * w)
- dense {a c : ℕ} (wName bName : String) (W : Mat a c) (bias : Vec c) : BatchableOp a c
- gap {c h w : ℕ} : BatchableOp (c * h * w) c
- seBlock {c h w r : ℕ} (w1Name b1Name w2Name b2Name : String) (W₁ : Mat c r) (b₁ : Vec r) (W₂ : Mat r c) (b₂ : Vec c) : BatchableOp (c * h * w) (c * h * w)
- bnEval {oc h w : ℕ} (gName bName muName varName epsStr : String) (ε : ℝ) (γ β μ var : Vec oc) : BatchableOp (oc * h * w) (oc * h * w)
- swish {n : ℕ} : BatchableOp n n
- relu {n : ℕ} : BatchableOp n n
- relu6 {n : ℕ} : BatchableOp n n
- maxPool {c h w : ℕ} : BatchableOp (c * (2 * h) * (2 * w)) (c * h * w)
- maxPool3s2 {c h w : ℕ} : BatchableOp (c * (2 * h) * (2 * w)) (c * h * w)
- softmaxRow {m n : ℕ} : BatchableOp (m * n) (m * n)
- denseRowBack {rows a c : ℕ} (wName : String) (W : Mat a c) : BatchableOp (rows * c) (rows * a)
- denseRowBackBf16 {rows a c : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : Mat a c) : BatchableOp (rows * c) (rows * a)
- gelu {n : ℕ} : BatchableOp n n
- transpose {m n : ℕ} : BatchableOp (m * n) (n * m)
- convStride4 {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * (2 * (2 * h)) * (2 * (2 * w))) (oc * h * w)
- convStride4Bf16 {ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Kernel4 oc ic kH kW) (bias : Vec oc) : BatchableOp (ic * (2 * (2 * h)) * (2 * (2 * w))) (oc * h * w)
- layerScaleCh {c h w : ℕ} (γName : String) (γ : Vec c) : BatchableOp (c * h * w) (c * h * w)
- dotOut {m n : ℕ} (wName : String) (W : Mat m n) : BatchableOp n m
- expe {n : ℕ} : BatchableOp n n
- softmaxDiv {n : ℕ} : BatchableOp n n
- lnRow {m n : ℕ} (gName bName epsStr : String) (ε γ β : ℝ) : BatchableOp (m * n) (m * n)
- rowScale {m n : ℕ} (gName : String) (γ : Vec n) : BatchableOp (m * n) (m * n)
- rowBias {m n : ℕ} (bName : String) (β : Vec n) : BatchableOp (m * n) (m * n)
- denseRow {N a c : ℕ} (wName bName : String) (W : Mat a c) (b : Vec c) : BatchableOp (N * a) (N * c)
- denseRowBf16 {N a c : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Mat a c) (b : Vec c) : BatchableOp (N * a) (N * c)
- patchEmbed {ic H W P N D : ℕ} (wName bName clsName posName : String) (Wc : Kernel4 D ic P P) (bc cls : Vec D) (pos : Mat (N + 1) D) : BatchableOp (ic * H * W) ((N + 1) * D)
- patchEmbedBf16 {ic H W P N D : ℕ} (rnd : ℝ → ℝ) (wName bName clsName posName : String) (Wc : Kernel4 D ic P P) (bc cls : Vec D) (pos : Mat (N + 1) D) : BatchableOp (ic * H * W) ((N + 1) * D)
- clsSlice {N D : ℕ} : BatchableOp ((N + 1) * D) D
- clsPad {N D : ℕ} : BatchableOp D ((N + 1) * D)
- headSlice {N heads d : ℕ} (h : Fin heads) : BatchableOp (N * (heads * d)) (N * d)
- headPad {N heads d : ℕ} (h : Fin heads) : BatchableOp (N * d) (N * (heads * d))
Instances For
A StableHLO-subset expression, shape-indexed by result length. Leaves carry
both a value (for den) and an SSA name (for pretty); the name is
denotation-irrelevant. One constructor per emitted op.
- operand {n : ℕ} (name : String) (v : Vec n) : SHlo n
- dotIn {m n : ℕ} (wName : String) (W : Mat m n) : SHlo m → SHlo n
- dotInBf16 {m n : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : Mat m n) : SHlo m → SHlo n
- dotOut {m n : ℕ} (wName : String) (W : Mat m n) : SHlo n → SHlo m
- addBcast {n : ℕ} (bName : String) (b : Vec n) : SHlo n → SHlo n
- expe {n : ℕ} : SHlo n → SHlo n
- softmaxDiv {n : ℕ} : SHlo n → SHlo n
- sub {n : ℕ} : SHlo n → SHlo n → SHlo n
- weightSgd {m n : ℕ} (xName wName lrStr : String) (x : Vec m) (W : Mat m n) (lr : ℝ) : SHlo n → SHlo (m * n)
- biasSgd {n : ℕ} (bName lrStr : String) (b : Vec n) (lr : ℝ) : SHlo n → SHlo n
- reluF {n : ℕ} : SHlo n → SHlo n
- selectPos {n : ℕ} (xName : String) (x : Vec n) : SHlo n → SHlo n
- relu6F {n : ℕ} : SHlo n → SHlo n
- selectMid {n : ℕ} (xName : String) (x : Vec n) : SHlo n → SHlo n
- convertF {n : ℕ} (rnd : ℝ → ℝ) : SHlo n → SHlo n
- flatConvF {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (ic * h * w) → SHlo (oc * h * w)
- flatConvFBf16 {ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName bName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (ic * h * w) → SHlo (oc * h * w)
- maxPoolF {c h w : ℕ} : SHlo (c * (2 * h) * (2 * w)) → SHlo (c * h * w)
- maxPool3s2F {c h w : ℕ} : SHlo (c * (2 * h) * (2 * w)) → SHlo (c * h * w)
- convBack {ic oc h w kH kW : ℕ} (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) (v : Vec (ic * h * w)) : SHlo (oc * h * w) → SHlo (ic * h * w)
- maxPoolBack {c h w : ℕ} (xName : String) (x : Vec (c * (2 * h) * (2 * w))) : SHlo (c * h * w) → SHlo (c * (2 * h) * (2 * w))
- maxPool3s2Back {c h w : ℕ} (xName : String) (x : Vec (c * (2 * h) * (2 * w))) : SHlo (c * h * w) → SHlo (c * (2 * h) * (2 * w))
- convWeightSgd {ic oc h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec oc) (x : Tensor3 ic h w) (W : Kernel4 oc ic kH kW) (lr : ℝ) : SHlo (oc * h * w) → SHlo (oc * ic * kH * kW)
- convBiasSgd {ic oc h w kH kW : ℕ} (bName lrStr : String) (W : Kernel4 oc ic kH kW) (x : Tensor3 ic h w) (b : Vec oc) (lr : ℝ) : SHlo (oc * h * w) → SHlo oc
- bnGammaSgd {oc h w : ℕ} (gName vName epsStr lrStr : String) (ε : ℝ) (γ : Vec oc) (v : Vec (oc * h * w)) (lr : ℝ) : SHlo (oc * h * w) → SHlo oc
- bnBetaSgd {oc h w : ℕ} (bName lrStr : String) (β : Vec oc) (lr : ℝ) : SHlo (oc * h * w) → SHlo oc
- bnF {n : ℕ} (gName bName epsStr : String) (ε γ β : ℝ) : SHlo n → SHlo n
- bnBack {n : ℕ} (gName xName epsStr : String) (ε γ : ℝ) (x : Vec n) : SHlo n → SHlo n
- addV {n : ℕ} : SHlo n → SHlo n → SHlo n
- addVB {N n : ℕ} : SHlo (N * n) → SHlo (N * n) → SHlo (N * n)
- subB {N n : ℕ} : SHlo (N * n) → SHlo (N * n) → SHlo (N * n)
- gapF {c h w : ℕ} : SHlo (c * h * w) → SHlo c
- gapBack {c h w : ℕ} : SHlo c → SHlo (c * h * w)
- broadcastBack {c h w : ℕ} : SHlo (c * h * w) → SHlo c
- flatConvStridedF {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (ic * (2 * h) * (2 * w)) → SHlo (oc * h * w)
- flatConvStridedXlaF {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (ic * (2 * h) * (2 * w)) → SHlo (oc * h * w)
- convStridedBack {ic oc h w kH kW : ℕ} (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) (v : Vec (ic * (2 * h) * (2 * w))) : SHlo (oc * h * w) → SHlo (ic * (2 * h) * (2 * w))
- convStridedWeightSgd {ic oc h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec oc) (x : Vec (ic * (2 * h) * (2 * w))) (W : Kernel4 oc ic kH kW) (lr : ℝ) : SHlo (oc * h * w) → SHlo (oc * ic * kH * kW)
- convStridedBiasSgd {ic oc h w kH kW : ℕ} (bName lrStr : String) (W : Kernel4 oc ic kH kW) (x : Vec (ic * (2 * h) * (2 * w))) (b : Vec oc) (lr : ℝ) : SHlo (oc * h * w) → SHlo oc
- convStridedXlaWeightSgd {ic oc h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec oc) (x : Vec (ic * (2 * h) * (2 * w))) (W : Kernel4 oc ic kH kW) (lr : ℝ) : SHlo (oc * h * w) → SHlo (oc * ic * kH * kW)
- convStridedXlaBiasSgd {ic oc h w kH kW : ℕ} (bName lrStr : String) (W : Kernel4 oc ic kH kW) (x : Vec (ic * (2 * h) * (2 * w))) (b : Vec oc) (lr : ℝ) : SHlo (oc * h * w) → SHlo oc
- depthwiseWeightSgd {c h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec c) (x : Tensor3 c h w) (W : DepthwiseKernel c kH kW) (lr : ℝ) : SHlo (c * h * w) → SHlo (c * kH * kW)
- depthwiseBiasSgd {c h w kH kW : ℕ} (bName lrStr : String) (W : DepthwiseKernel c kH kW) (x : Tensor3 c h w) (b : Vec c) (lr : ℝ) : SHlo (c * h * w) → SHlo c
- depthwiseStridedWeightSgd {c h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec c) (x : Vec (c * (2 * h) * (2 * w))) (W : DepthwiseKernel c kH kW) (lr : ℝ) : SHlo (c * h * w) → SHlo (c * kH * kW)
- depthwiseStridedBiasSgd {c h w kH kW : ℕ} (bName lrStr : String) (W : DepthwiseKernel c kH kW) (x : Vec (c * (2 * h) * (2 * w))) (b : Vec c) (lr : ℝ) : SHlo (c * h * w) → SHlo c
- depthwiseStridedXlaWeightSgd {c h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec c) (x : Vec (c * (2 * h) * (2 * w))) (W : DepthwiseKernel c kH kW) (lr : ℝ) : SHlo (c * h * w) → SHlo (c * kH * kW)
- depthwiseStridedXlaBiasSgd {c h w kH kW : ℕ} (bName lrStr : String) (W : DepthwiseKernel c kH kW) (x : Vec (c * (2 * h) * (2 * w))) (b : Vec c) (lr : ℝ) : SHlo (c * h * w) → SHlo c
- layerScaleChGammaSgd {c h w : ℕ} (gName xName lrStr : String) (x : Vec (c * h * w)) (γ : Vec c) (lr : ℝ) : SHlo (c * h * w) → SHlo c
- lnGammaSgd {n : ℕ} (gName xName epsStr lrStr : String) (ε : ℝ) (x : Vec n) (γ : Vec 1) (lr : ℝ) : SHlo n → SHlo 1
- lnBetaSgd {n : ℕ} (bName lrStr : String) (β : Vec 1) (lr : ℝ) : SHlo n → SHlo 1
- veclnGammaSgd {N D : ℕ} (gName xName epsStr lrStr : String) (ε : ℝ) (x : Vec (N * D)) (γ : Vec D) (lr : ℝ) : SHlo (N * D) → SHlo D
- patchEmbedWeightSgd {ic H W P N D : ℕ} (wName xName lrStr : String) (x : Vec (ic * H * W)) (Wp : Kernel4 D ic P P) (lr : ℝ) : SHlo ((N + 1) * D) → SHlo (D * ic * P * P)
- patchEmbedBiasSgd {N c : ℕ} (bName lrStr : String) (b : Vec c) (lr : ℝ) : SHlo ((N + 1) * c) → SHlo c
- posEmbedSgd {N D : ℕ} (pName lrStr : String) (pos : Mat (N + 1) D) (lr : ℝ) : SHlo ((N + 1) * D) → SHlo ((N + 1) * D)
- flatConvStride4F {ic oc h w kH kW : ℕ} (wName bName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (ic * (2 * (2 * h)) * (2 * (2 * w))) → SHlo (oc * h * w)
- bnPerChannelF {oc h w : ℕ} (gName bName epsStr : String) (ε : ℝ) (γ β : Vec oc) : SHlo (oc * h * w) → SHlo (oc * h * w)
- bnPerChannelBack {oc h w : ℕ} (gName xName epsStr : String) (ε : ℝ) (γ : Vec oc) (x : Vec (oc * h * w)) : SHlo (oc * h * w) → SHlo (oc * h * w)
- bnPerChannelEvalF {oc h w : ℕ} (gName bName muName varName epsStr : String) (ε : ℝ) (γ β μ var : Vec oc) : SHlo (oc * h * w) → SHlo (oc * h * w)
- depthwiseF {c h w kH kW : ℕ} (wName bName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (c * h * w) → SHlo (c * h * w)
- depthwiseBack {c h w kH kW : ℕ} (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) (v : Vec (c * h * w)) : SHlo (c * h * w) → SHlo (c * h * w)
- depthwiseStridedF {c h w kH kW : ℕ} (wName bName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (c * (2 * h) * (2 * w)) → SHlo (c * h * w)
- depthwiseStridedXlaF {c h w kH kW : ℕ} (wName bName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (c * (2 * h) * (2 * w)) → SHlo (c * h * w)
- depthwiseStridedBack {c h w kH kW : ℕ} (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) (v : Vec (c * (2 * h) * (2 * w))) : SHlo (c * h * w) → SHlo (c * (2 * h) * (2 * w))
- depthwiseStridedXlaBack {c h w kH kW : ℕ} (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) (v : Vec (c * (2 * h) * (2 * w))) : SHlo (c * h * w) → SHlo (c * (2 * h) * (2 * w))
- swishF {n : ℕ} : SHlo n → SHlo n
- swishBack {n : ℕ} (xName : String) (x : Vec n) : SHlo n → SHlo n
- sigmoidF {n : ℕ} : SHlo n → SHlo n
- sigmoidBack {n : ℕ} (xName : String) (x : Vec n) : SHlo n → SHlo n
- maxPoolBackB {N c h w : ℕ} (xName : String) (x : Vec (N * (c * (2 * h) * (2 * w)))) : SHlo (N * (c * h * w)) → SHlo (N * (c * (2 * h) * (2 * w)))
- maxPool3s2BackB {N c h w : ℕ} (xName : String) (x : Vec (N * (c * (2 * h) * (2 * w)))) : SHlo (N * (c * h * w)) → SHlo (N * (c * (2 * h) * (2 * w)))
- convBiasSgdB {N ic oc h w kH kW : ℕ} (bName lrStr : String) (W : Kernel4 oc ic kH kW) (x : Vec (N * (ic * h * w))) (b : Vec oc) (lr : ℝ) : SHlo (N * (oc * h * w)) → SHlo oc
- convStridedBiasSgdB {N ic oc h w kH kW : ℕ} (bName lrStr : String) (W : Kernel4 oc ic kH kW) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (b : Vec oc) (lr : ℝ) : SHlo (N * (oc * h * w)) → SHlo oc
- selectPosB {N n : ℕ} (xName : String) (x : Vec (N * n)) : SHlo (N * n) → SHlo (N * n)
- selectMidB {N n : ℕ} (xName : String) (x : Vec (N * n)) : SHlo (N * n) → SHlo (N * n)
- dropPathB {N n : ℕ} (mName : String) (s : Vec N) : SHlo (N * n) → SHlo (N * n)
- dropoutB {N n : ℕ} (mName : String) (mask : Vec (N * n)) : SHlo (N * n) → SHlo (N * n)
- swishBackB {N n : ℕ} (xName : String) (x : Vec (N * n)) : SHlo (N * n) → SHlo (N * n)
- geluBackB {N n : ℕ} (xName : String) (x : Vec (N * n)) : SHlo (N * n) → SHlo (N * n)
- convStride4WeightGradB {N ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Vec (N * (ic * (2 * (2 * h)) * (2 * (2 * w))))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStride4WeightGradBBf16 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec oc) (x : Vec (N * (ic * (2 * (2 * h)) * (2 * (2 * w))))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- layerScaleChGammaGradB {N c h w : ℕ} (xName : String) (x : Vec (N * (c * h * w))) : SHlo (N * (c * h * w)) → SHlo c
- veclnGammaGradB {N R D : ℕ} (xName epsStr : String) (ε : ℝ) (x : Vec (N * (R * D))) : SHlo (N * (R * D)) → SHlo D
- rowDenseBiasGradB {N R c : ℕ} : SHlo (N * (R * c)) → SHlo c
- weightGradB {N m n : ℕ} (xName : String) (x : Vec (N * m)) : SHlo (N * n) → SHlo (m * n)
- biasGradB {N n : ℕ} : SHlo (N * n) → SHlo (N * n)
- lnRowBackB {N m n : ℕ} (gName xName epsStr : String) (ε γ : ℝ) (x : Vec (N * (m * n))) : SHlo (N * (m * n)) → SHlo (N * (m * n))
- sigmoidB {N n : ℕ} : SHlo (N * n) → SHlo (N * n)
- sigmoidBackB {N n : ℕ} (xName : String) (x : Vec (N * n)) : SHlo (N * n) → SHlo (N * n)
- matmulFB {N m k n : ℕ} : SHlo (N * (m * k)) → SHlo (N * (k * n)) → SHlo (N * (m * n))
- matmulFBBf16 {N m k n : ℕ} (rnd : ℝ → ℝ) : SHlo (N * (m * k)) → SHlo (N * (k * n)) → SHlo (N * (m * n))
- softmaxRowBackB {N m n : ℕ} (xName : String) (preAct : Vec (N * (m * n))) : SHlo (N * (m * n)) → SHlo (N * (m * n))
- rowDenseWeightGradB {N tk a c : ℕ} (xName : String) (x : Vec (N * (tk * a))) : SHlo (N * (tk * c)) → SHlo (a * c)
- rowDenseWeightGradBBf16 {N tk a c : ℕ} (rnd : ℝ → ℝ) (xName : String) (x : Vec (N * (tk * a))) : SHlo (N * (tk * c)) → SHlo (a * c)
- posEmbedGradB {N tk D : ℕ} : SHlo (N * ((tk + 1) * D)) → SHlo ((tk + 1) * D)
- patchEmbedWeightGradB {N ic H W P tk D : ℕ} (xName : String) (x : Vec (N * (ic * H * W))) : SHlo (N * ((tk + 1) * D)) → SHlo (D * ic * P * P)
- patchEmbedWeightGradBBf16 {N ic H W P tk D : ℕ} (rnd : ℝ → ℝ) (xName : String) (x : Vec (N * (ic * H * W))) : SHlo (N * ((tk + 1) * D)) → SHlo (D * ic * P * P)
- patchEmbedBiasGradB {N tk c : ℕ} : SHlo (N * ((tk + 1) * c)) → SHlo c
- geluF {n : ℕ} : SHlo n → SHlo n
- geluBack {n : ℕ} (xName : String) (x : Vec n) : SHlo n → SHlo n
- layerScaleF {n : ℕ} (γName : String) (γ : Vec n) : SHlo n → SHlo n
- layerScaleChF {c h w : ℕ} (γName : String) (γ : Vec c) : SHlo (c * h * w) → SHlo (c * h * w)
- softmaxRowF {m n : ℕ} : SHlo (m * n) → SHlo (m * n)
- softmaxRowBack {m n : ℕ} (xName : String) (preAct : Vec (m * n)) : SHlo (m * n) → SHlo (m * n)
- matmulF {m k n : ℕ} : SHlo (m * k) → SHlo (k * n) → SHlo (m * n)
- transposeF {m n : ℕ} : SHlo (m * n) → SHlo (n * m)
- scaleF {n : ℕ} (sStr : String) (s : ℝ) : SHlo n → SHlo n
- lnRowF {m n : ℕ} (gName bName epsStr : String) (ε γ β : ℝ) : SHlo (m * n) → SHlo (m * n)
- lnRowBack {m n : ℕ} (gName xName epsStr : String) (ε γ : ℝ) (x : Vec (m * n)) : SHlo (m * n) → SHlo (m * n)
- denseRowF {N a c : ℕ} (wName bName : String) (W : Mat a c) (b : Vec c) : SHlo (N * a) → SHlo (N * c)
- denseRowBack {N a c : ℕ} (wName : String) (W : Mat a c) : SHlo (N * c) → SHlo (N * a)
- patchEmbedF {ic H W P N D : ℕ} (wName bName clsName posName : String) (Wc : Kernel4 D ic P P) (bc cls : Vec D) (pos : Mat (N + 1) D) : SHlo (ic * H * W) → SHlo ((N + 1) * D)
- patchEmbedBack {ic H W P N D : ℕ} (wName : String) (Wc : Kernel4 D ic P P) : SHlo ((N + 1) * D) → SHlo (ic * H * W)
- clsSliceF {N D : ℕ} : SHlo ((N + 1) * D) → SHlo D
- clsPadF {N D : ℕ} : SHlo D → SHlo ((N + 1) * D)
- headSliceF {N heads d : ℕ} (h : Fin heads) : SHlo (N * (heads * d)) → SHlo (N * d)
- headPadF {N heads d : ℕ} (h : Fin heads) : SHlo (N * d) → SHlo (N * (heads * d))
- rowScaleF {m n : ℕ} (gName : String) (γ : Vec n) : SHlo (m * n) → SHlo (m * n)
- rowBiasF {m n : ℕ} (bName : String) (β : Vec n) : SHlo (m * n) → SHlo (m * n)
- batchOp {N a b : ℕ} (op : BatchableOp a b) : SHlo (N * a) → SHlo (N * b)
- bnBatchF {N oc h w : ℕ} (gName bName epsStr : String) (ε : ℝ) (γ β : Vec oc) : SHlo (N * (oc * h * w)) → SHlo (N * (oc * h * w))
- bnBatchBack {N oc h w : ℕ} (gName xName epsStr : String) (ε : ℝ) (γ : Vec oc) (x : Vec (N * (oc * (h * w)))) : SHlo (N * (oc * (h * w))) → SHlo (N * (oc * (h * w)))
- convBackBatched {N ic oc h w kH kW : ℕ} (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo (N * (ic * h * w))
- convStridedBackBatched {N ic oc h w kH kW : ℕ} (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo (N * (ic * (2 * h) * (2 * w)))
- convBackBatchedBf16 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo (N * (ic * h * w))
- convBackBatchedF8 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo (N * (ic * h * w))
- convStridedBackBatchedBf16 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : Kernel4 oc ic kH kW) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo (N * (ic * (2 * h) * (2 * w)))
- depthwiseBackBatched {N c h w kH kW : ℕ} (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo (N * (c * h * w))
- depthwiseBackBatchedBf16 {N c h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo (N * (c * h * w))
- depthwiseStridedBackBatched {N c h w kH kW : ℕ} (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo (N * (c * (2 * h) * (2 * w)))
- depthwiseStridedBackBatchedBf16 {N c h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo (N * (c * (2 * h) * (2 * w)))
- depthwiseStridedXlaBackBatched {N c h w kH kW : ℕ} (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo (N * (c * (2 * h) * (2 * w)))
- depthwiseStridedXlaBackBatchedBf16 {N c h w kH kW : ℕ} (rnd : ℝ → ℝ) (wName : String) (W : DepthwiseKernel c kH kW) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo (N * (c * (2 * h) * (2 * w)))
- bnBatchLABack {N oc h w : ℕ} (gName xName epsStr : String) (ε : ℝ) (γ : Vec oc) (x : Vec (N * (oc * h * w))) : SHlo (N * (oc * h * w)) → SHlo (N * (oc * h * w))
- seBackBatched {N c h w r : ℕ} (w1Name b1Name w2Name b2Name vName : String) (W₁ : Mat c r) (b₁ : Vec r) (W₂ : Mat r c) (b₂ : Vec c) (v : Vec (N * (c * h * w))) : SHlo (N * (c * h * w)) → SHlo (N * (c * h * w))
- seReduceB {N c h w : ℕ} (xName : String) (x : Vec (N * (c * h * w))) : SHlo (N * (c * h * w)) → SHlo (N * c)
- gapBackBatched {N c h w : ℕ} : SHlo (N * c) → SHlo (N * (c * h * w))
- bnGammaSgdB {N oc h w : ℕ} (gName vName epsStr lrStr : String) (ε : ℝ) (γ : Vec oc) (v : Vec (N * (oc * (h * w)))) (lr : ℝ) : SHlo (N * (oc * (h * w))) → SHlo oc
- bnBetaSgdB {N oc h w : ℕ} (bName lrStr : String) (β : Vec oc) (lr : ℝ) : SHlo (N * (oc * (h * w))) → SHlo oc
- denseWeightSgdB {N a c : ℕ} (xName wName lrStr : String) (x : Vec (N * a)) (W : Mat a c) (lr : ℝ) : SHlo (N * c) → SHlo (a * c)
- denseBiasSgdB {N c : ℕ} (bName lrStr : String) (b : Vec c) (lr : ℝ) : SHlo (N * c) → SHlo c
- convWeightGradB {N ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Vec (N * (ic * h * w))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStridedWeightGradB {N ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convWeightGradBBf16 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec oc) (x : Vec (N * (ic * h * w))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convWeightGradBF8 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec oc) (x : Vec (N * (ic * h * w))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStridedWeightGradBBf16 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convBiasGradB {N ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (x : Vec (N * (ic * h * w))) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo oc
- convStridedBiasGradB {N ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo oc
- convStridedXlaWeightGradB {N ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStridedXlaWeightGradBBf16 {N ic oc h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (W : Kernel4 oc ic kH kW) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStridedXlaBiasGradB {N ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (b : Vec oc) : SHlo (N * (oc * h * w)) → SHlo oc
- bnGammaGradB {N oc h w : ℕ} (vName epsStr : String) (ε : ℝ) (v : Vec (N * (oc * (h * w)))) : SHlo (N * (oc * (h * w))) → SHlo oc
- bnBetaGradB {N oc h w : ℕ} : SHlo (N * (oc * (h * w))) → SHlo oc
- denseWeightGradB {N a c : ℕ} (xName : String) (x : Vec (N * a)) : SHlo (N * c) → SHlo (a * c)
- denseBiasGradB {N c : ℕ} : SHlo (N * c) → SHlo c
- bnBatchMeanB {N oc h w : ℕ} : SHlo (N * (oc * (h * w))) → SHlo oc
- bnBatchVarB {N oc h w : ℕ} : SHlo (N * (oc * (h * w))) → SHlo oc
- scaleB {N n : ℕ} (sStr : String) (s : ℝ) : SHlo (N * n) → SHlo (N * n)
- shiftB {N n : ℕ} (sStr : String) (s : ℝ) : SHlo (N * n) → SHlo (N * n)
- divConstB {N n : ℕ} (sStr : String) (s : ℝ) : SHlo (N * n) → SHlo (N * n)
- allReduceMeanF {n : ℕ} (R : ℕ) (hR : 0 < R) (t : String) (ds : List ℕ) (g : Fin R → SHlo n) : SHlo n
- rowDenseWeightSgd {N a c : ℕ} (xName wName lrStr : String) (x : Vec (N * a)) (W : Mat a c) (lr : ℝ) : SHlo (N * c) → SHlo (a * c)
- rowDenseBiasSgd {N c : ℕ} (bName lrStr : String) (b : Vec c) (lr : ℝ) : SHlo (N * c) → SHlo c
- convWeightSgdB {N ic oc h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec oc) (x : Vec (N * (ic * h * w))) (W : Kernel4 oc ic kH kW) (lr : ℝ) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStridedWeightSgdB {N ic oc h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (W : Kernel4 oc ic kH kW) (lr : ℝ) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- convStridedXlaWeightSgdB {N ic oc h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec oc) (x : Vec (N * (ic * (2 * h) * (2 * w)))) (W : Kernel4 oc ic kH kW) (lr : ℝ) : SHlo (N * (oc * h * w)) → SHlo (oc * ic * kH * kW)
- depthwiseWeightSgdB {N c h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec c) (x : Vec (N * (c * h * w))) (W : DepthwiseKernel c kH kW) (lr : ℝ) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseStridedWeightSgdB {N c h w kH kW : ℕ} (xName wName lrStr : String) (b : Vec c) (x : Vec (N * (c * (2 * h) * (2 * w)))) (W : DepthwiseKernel c kH kW) (lr : ℝ) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- weightGrad {m n : ℕ} (xName : String) (x : Vec m) : SHlo n → SHlo (m * n)
- biasGrad {n : ℕ} : SHlo n → SHlo n
- convWeightGrad {ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Tensor3 ic h w) (W : Kernel4 oc ic kH kW) : SHlo (oc * h * w) → SHlo (oc * ic * kH * kW)
- convBiasGrad {ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (x : Tensor3 ic h w) (b : Vec oc) : SHlo (oc * h * w) → SHlo oc
- convStridedWeightGrad {ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Vec (ic * (2 * h) * (2 * w))) (W : Kernel4 oc ic kH kW) : SHlo (oc * h * w) → SHlo (oc * ic * kH * kW)
- convStride4WeightGrad {ic oc h w kH kW : ℕ} (xName : String) (b : Vec oc) (x : Vec (ic * (2 * (2 * h)) * (2 * (2 * w)))) (W : Kernel4 oc ic kH kW) : SHlo (oc * h * w) → SHlo (oc * ic * kH * kW)
- convStridedBiasGrad {ic oc h w kH kW : ℕ} (W : Kernel4 oc ic kH kW) (x : Vec (ic * (2 * h) * (2 * w))) (b : Vec oc) : SHlo (oc * h * w) → SHlo oc
- bnGammaGrad {oc h w : ℕ} (vName epsStr : String) (ε : ℝ) (v : Vec (oc * h * w)) : SHlo (oc * h * w) → SHlo oc
- bnBetaGrad {oc h w : ℕ} : SHlo (oc * h * w) → SHlo oc
- rowDenseWeightGrad {N a c : ℕ} (xName : String) (x : Vec (N * a)) : SHlo (N * c) → SHlo (a * c)
- rowDenseBiasGrad {N c : ℕ} : SHlo (N * c) → SHlo c
- veclnGammaGrad {N D : ℕ} (xName epsStr : String) (ε : ℝ) (x : Vec (N * D)) : SHlo (N * D) → SHlo D
- patchEmbedWeightGrad {ic H W P N D : ℕ} (xName : String) (x : Vec (ic * H * W)) : SHlo ((N + 1) * D) → SHlo (D * ic * P * P)
- patchEmbedBiasGrad {N c : ℕ} : SHlo ((N + 1) * c) → SHlo c
- posEmbedGrad {N D : ℕ} : SHlo ((N + 1) * D) → SHlo ((N + 1) * D)
- depthwiseWeightGradB {N c h w kH kW : ℕ} (xName : String) (b : Vec c) (x : Vec (N * (c * h * w))) (W : DepthwiseKernel c kH kW) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseWeightGradBBf16 {N c h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec c) (x : Vec (N * (c * h * w))) (W : DepthwiseKernel c kH kW) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseStridedWeightGradB {N c h w kH kW : ℕ} (xName : String) (b : Vec c) (x : Vec (N * (c * (2 * h) * (2 * w)))) (W : DepthwiseKernel c kH kW) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseStridedWeightGradBBf16 {N c h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec c) (x : Vec (N * (c * (2 * h) * (2 * w)))) (W : DepthwiseKernel c kH kW) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseBiasGradB {N c h w kH kW : ℕ} (W : DepthwiseKernel c kH kW) (x : Vec (N * (c * h * w))) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo c
- depthwiseStridedBiasGradB {N c h w kH kW : ℕ} (W : DepthwiseKernel c kH kW) (x : Vec (N * (c * (2 * h) * (2 * w)))) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo c
- depthwiseStridedXlaWeightGradB {N c h w kH kW : ℕ} (xName : String) (b : Vec c) (x : Vec (N * (c * (2 * h) * (2 * w)))) (W : DepthwiseKernel c kH kW) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseStridedXlaWeightGradBBf16 {N c h w kH kW : ℕ} (rnd : ℝ → ℝ) (xName : String) (b : Vec c) (x : Vec (N * (c * (2 * h) * (2 * w)))) (W : DepthwiseKernel c kH kW) : SHlo (N * (c * h * w)) → SHlo (c * kH * kW)
- depthwiseStridedXlaBiasGradB {N c h w kH kW : ℕ} (W : DepthwiseKernel c kH kW) (x : Vec (N * (c * (2 * h) * (2 * w)))) (b : Vec c) : SHlo (N * (c * h * w)) → SHlo c
- depthwiseWeightGrad {c h w kH kW : ℕ} (xName : String) (b : Vec c) (x : Tensor3 c h w) (W : DepthwiseKernel c kH kW) : SHlo (c * h * w) → SHlo (c * kH * kW)
- depthwiseBiasGrad {c h w kH kW : ℕ} (W : DepthwiseKernel c kH kW) (x : Tensor3 c h w) (b : Vec c) : SHlo (c * h * w) → SHlo c
- lnGammaGrad {n : ℕ} (xName epsStr : String) (ε : ℝ) (x : Vec n) : SHlo n → SHlo 1
- lnBetaGrad {n : ℕ} : SHlo n → SHlo 1
- layerScaleChGammaGrad {c h w : ℕ} (xName : String) (x : Vec (c * h * w)) : SHlo (c * h * w) → SHlo c
- adamMNextF {n : ℕ} (mName b1Name ob1Name : String) (ds : List ℕ) (β₁ : ℝ) (m : Vec n) : SHlo n → SHlo n
- adamVNextF {n : ℕ} (vName b2Name ob2Name : String) (ds : List ℕ) (β₂ : ℝ) (v : Vec n) : SHlo n → SHlo n
- adamWParamF {n : ℕ} (θName mName vName b1Name ob1Name b2Name ob2Name bc1Name bc2Name lrName epsName wdName : String) (ds : List ℕ) (β₁ β₂ ε lr wd bc₁ bc₂ : ℝ) (θ m v : Vec n) : SHlo n → SHlo n
- sgdParamF {n : ℕ} (θName lrName : String) (ds : List ℕ) (lr : ℝ) (θ : Vec n) : SHlo n → SHlo n
- momVNextF {n : ℕ} (vName muName : String) (ds : List ℕ) (μ : ℝ) (v : Vec n) : SHlo n → SHlo n
- momParamF {n : ℕ} (θName vName muName lrName : String) (ds : List ℕ) (μ lr : ℝ) (θ v : Vec n) : SHlo n → SHlo n
- rmsBufNextF {n : ℕ} (sqName bufName rhoName orhoName muName epsName : String) (ds : List ℕ) (ρ μ ε : ℝ) (sq buf : Vec n) : SHlo n → SHlo n
- gradSumSqAccF {n : ℕ} (ds : List ℕ) : SHlo 1 → SHlo n → SHlo 1
- clipScaleF {n : ℕ} (clipStr epsStr : String) (c ε : ℝ) (ds : List ℕ) : SHlo 1 → SHlo n → SHlo n
- lambDirF {n : ℕ} (θName mName vName b1Name ob1Name b2Name ob2Name bc1Name bc2Name epsName wdName : String) (ds : List ℕ) (β₁ β₂ ε wd bc₁ bc₂ : ℝ) (θ m v : Vec n) : SHlo n → SHlo n
- lambScaleF {n : ℕ} (ds : List ℕ) : SHlo 1 → SHlo n → SHlo n
Instances For
3×3/s2 max-pool backward (flattened) — the peer of maxPoolBackFlat at He et al.'s stem
pool, matching maxPool3s2_has_vjp_at3.backward lifted through hasVJPAt3_to_hasVJPAt. Total
in the saved input xv (the no-ties proof lives only in .correct).
⚠⚠ This is a SUM where the 2×2 peer is a lookup, and that is the whole difference between the
two pools. maxPool2's windows tile, so each input is the argmax of at most one output and
the backward can name it directly. 3×3/s2 windows OVERLAP, so an input can be the argmax of up
to four outputs (win3Row_mem_le_two squared) and the cotangent must ACCUMULATE. Nothing in
HasVJPAt3.correct had to change for that — it already states the backward as a sum over all
outputs, and maxPool2's peer merely collapses it using disjointness.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Row-softmax (flattened) — apply the 1-D softmax (MLP.lean) to each of
the m rows of the row-major Vec (m*n). Definitionally equal to
Mat.flatten ∘ rowSoftmax ∘ Mat.unflatten (Attention.lean's rowSoftmax);
spelled with MLP's softmax so StableHLO needn't import Attention
(the tie to rowSoftmax is an rfl faithfulness lemma in TestSoftmaxRow).
Equations
- Proofs.StableHLO.rowSoftmaxFlat m n v = Proofs.Mat.flatten fun (i : Fin m) => Proofs.softmax n (Proofs.Mat.unflatten v i)
Instances For
Row-softmax backward (flattened) — per row, the proven closed form
pᵢ⊙(dyᵢ − ⟨pᵢ,dyᵢ⟩) with pᵢ = softmax(preActᵢ). Definitionally equal to
Mat.flatten ∘ rowSoftmax_has_vjp_mat.backward (Mat.unflatten preAct) ∘ Mat.unflatten
(since softmax_has_vjp.backward z dy i = let p := softmax z; p i·(dy i − ⟨p,dy⟩));
spelled with MLP's softmax to keep Attention out of StableHLO's imports.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Flattened matrix multiply C = A·B on row-major flat operands.
Definitionally Mat.flatten ∘ Mat.mul ∘ Mat.unflatten².
Equations
- Proofs.StableHLO.matMulFlat m k n a b = ((Proofs.Mat.unflatten a).mul (Proofs.Mat.unflatten b)).flatten
Instances For
Row-wise LayerNorm (flattened) — each of the m token rows gets the 1-D
bnForward over its n features (LayerNorm IS per-example BN:
layerNormForward := bnForward definitionally, LayerNorm.lean).
Equations
- Proofs.StableHLO.rowLNFlat m n ε γ β v = Proofs.Mat.flatten fun (i : Fin m) => Proofs.bnForward n ε γ β (Proofs.Mat.unflatten v i)
Instances For
Row-wise LayerNorm input-VJP (flattened) — per row the consolidated
three-term bn_grad_input, recomputing x̂/istd from the saved pre-LN input.
Equations
- Proofs.StableHLO.rowLNBackFlat m n ε γ x dy = Proofs.Mat.flatten fun (i : Fin m) => Proofs.bn_grad_input n ε γ (Proofs.Mat.unflatten x i) (Proofs.Mat.unflatten dy i)
Instances For
Per-token dense (flattened) — every row of the [N,a] flat through the
same dense W b.
Equations
- Proofs.StableHLO.rowDenseFlat N a c W b v = Proofs.Mat.flatten fun (i : Fin N) => Proofs.dense W b (Proofs.Mat.unflatten v i)
Instances For
Per-token dense input-VJP (flattened) — per row dX = W·dy (=
(dense_has_vjp W b).backward's Mat.mulVec W, MLP.lean).
Equations
- Proofs.StableHLO.rowDenseBackFlat N a c W dy = Proofs.Mat.flatten fun (i : Fin N) => W.mulVec (Proofs.Mat.unflatten dy i)
Instances For
ViT patch embedding (flattened) — a LOCAL re-spelling of the proven
patchEmbed_flat (Attention.lean), kept here so StableHLO needn't import
Attention (the tie is an rfl lemma in ViTFwdGraph). Output row n:
CLS token at n = 0, else conv-projection of patch n−1 + bias; plus the
position embedding everywhere.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ViT patch-embedding input-VJP (flattened) — a LOCAL re-spelling of the
proven patchEmbed_input_grad_formula (Attention.lean), kept here so
StableHLO needn't import Attention (the tie is an rfl lemma in
ViTBackB0). The closed-form image cotangent: a sum over patches p : Fin N
with reconstructed kernel offsets (kh, kw) matching the decoded input
position (c, hh, ww). The CLS row (n = 0) and the position-add (a
+constant, input-VJP = id) contribute nothing — idx_in only flows through
the conv-projection branch (n = p+1), so this is purely the strided 16×16
patchify conv's input-VJP on the patch-token part of the cotangent.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ViT patch-embedding weight-grad (flattened) — a LOCAL re-spelling of the proven
patchEmbed_weight_grad (Attention.lean), kept here so StableHLO needn't import
Attention (the tie is the §1-fold vit_render_patchW_certified). The non-overlapping
16×16/s16 patchify conv's weight-VJP: dW_(d,c,kh,kw) = Σ_patches (patch pixel read)· dy_(patch.succ, d) — token 0 is the CLS row (excluded); the pixel read mirrors
patchEmbedFlat's, and dy (finProdFinEquiv (p.succ, d)) mirrors patchEmbedBackFlat.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ViT patch embedding at bf16 operands (flattened) — patchEmbedFlat's body with the three
roundings the emit actually performs, and nothing else.
⚠⚠ The placement of each rnd is the whole content of this definition, so read it against
the emitted text rather than against the f32 peer:
rnd (W_conv …)andrnd (img …)are the two operand casts — thestablehlo.converts that make the convolution's inputsbf16.- the outer
rndon the patch sum is the bf16 STORE: the convolution is emitted with abf16-TYPED result, so the hardware accumulates the MAC in f32 and rounds on the way out. Dropping it would claim more precision than the hardware delivers — the unsound direction, and the trapplanning/archive/bf16_renderer.md§9.2 exists to name. b_conv,cls_tokenandpos_embedare added outside every rounding, because the emit adds them after the convert-back, in f32. They are f32 parameters that never reach a tensor core.
▶ The CLS row (n = 0) carries no convolution at all, so no rounding touches it — which is why
the if is INSIDE the roundings' scope rather than outside it.
Equations
- One or more equations did not get rendered due to their size.
Instances For
CLS slice (flattened) — gather row 0 of the [N+1,D] flat (= the proven
cls_slice_flat, Attention.lean; tie is rfl in ViTFwdGraph).
Equations
- Proofs.StableHLO.clsSliceFlat N D v k = v (finProdFinEquiv (0, k))
Instances For
CLS pad (flattened) — scatter dy to row 0, zeros elsewhere (= the proven
cls_slice_flat_has_vjp.backward; tie is rfl in ViTFwdGraph).
Equations
- Proofs.StableHLO.clsPadFlat N D dy idx = if (finProdFinEquiv.symm idx).1 = 0 then dy (finProdFinEquiv.symm idx).2 else 0
Instances For
Per-head column slice (flattened) — head h's [N,d] block of the
[N,heads·d] flat: the finProdFinEquiv (h, ·) column gather mhsa_layer
uses to feed each head's SDPA.
Equations
- Proofs.StableHLO.headSliceFlat N heads d h v = Proofs.Mat.flatten fun (r : Fin N) (j : Fin d) => Proofs.Mat.unflatten v r (finProdFinEquiv (h, j))
Instances For
Per-head column pad (flattened) — scatter an [N,d] head block into head
h's columns of a zero [N,heads·d]. mhsa_layer's concat is the sum of
these over heads; it is also headSliceFlat's VJP.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Row-broadcast scale (flattened) — every token row elementwise-scaled by the
shared γ : Vec n (= rowwise layerScale γ).
Equations
- Proofs.StableHLO.rowScaleFlat m n γ v = Proofs.Mat.flatten fun (r : Fin m) => Proofs.layerScale γ (Proofs.Mat.unflatten v r)
Instances For
Row-broadcast bias (flattened) — + β on every token row.
Equations
- Proofs.StableHLO.rowBiasFlat m n β v = Proofs.Mat.flatten fun (r : Fin m) (k : Fin n) => Proofs.Mat.unflatten v r k + β k
Instances For
Channel index of a flat c·h·w position (the repo's left-assoc
finProdFinEquiv convention: k ↔ ((chan, row), col)). Used to expand a
per-channel parameter (Vec c) to the flat per-element map.
Equations
- Proofs.StableHLO.chanIdx c h w k = (finProdFinEquiv.symm (finProdFinEquiv.symm k).1).1
Instances For
The proven per-example forward of a BatchableOp — exactly the existing
batch-1 op (flatConv/depthwiseFlat/dense/globalAvgPoolFlat/seBlockFull/…).
SHlo.batchOp's den is batchMap N (denOp op).
Equations
- One or more equations did not get rendered due to their size.
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.conv wName bName W bias) = Proofs.flatConv W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.convStrided wName bName W bias) = Proofs.flatConvStride2 W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.convStridedXla wName bName W bias) = Proofs.flatConvStride2Xla W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.depthwise wName bName W bias) = Proofs.depthwiseFlat W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.depthwiseStrided wName bName W bias) = Proofs.depthwiseStride2Flat W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.depthwiseStridedXla wName bName W bias) = Proofs.depthwiseStride2FlatXla W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.dense wName bName W bias) = Proofs.dense W bias
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.gap = Proofs.globalAvgPoolFlat x✝ h w
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.seBlock w1Name b1Name w2Name b2Name W₁ b₁ W₂ b₂) = Proofs.seBlockFull W₁ b₁ W₂ b₂
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.bnEval gName bName muName varName epsStr ε γ β μ var) = Proofs.bnPerChannelEvalTensor3 oc h w ε γ β μ var
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.swish = Proofs.swish x✝
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.relu = Proofs.relu x✝
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.relu6 = Proofs.relu6 x✝
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.maxPool = Proofs.maxPoolFlat c h w
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.maxPool3s2 = Proofs.maxPool3s2Flat c h w
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.softmaxRow = Proofs.StableHLO.rowSoftmaxFlat m n
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.denseRowBack wName W) = Proofs.StableHLO.rowDenseBackFlat rows a c W
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.gelu = Proofs.gelu x✝
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.transpose = Proofs.StableHLO.transposeFlat m n
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.convStride4 wName bName W bias) = Proofs.flatConvStride4 W bias
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.dotOut wName W) = fun (v : Proofs.Vec x✝¹) (i : Fin x✝) => ∑ j : Fin x✝¹, W i j * v j
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.expe = fun (v : Proofs.Vec x✝) (j : Fin x✝) => Real.exp (v j)
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.softmaxDiv = fun (v : Proofs.Vec x✝) (j : Fin x✝) => v j / ∑ k : Fin x✝, v k
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.lnRow gName bName epsStr ε γ β) = Proofs.StableHLO.rowLNFlat m n ε γ β
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.rowScale gName γ) = Proofs.StableHLO.rowScaleFlat m n γ
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.rowBias bName β) = Proofs.StableHLO.rowBiasFlat m n β
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.denseRow wName bName W b) = Proofs.StableHLO.rowDenseFlat N a c W b
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.patchEmbed wName bName clsName posName Wc bc cls pos) = Proofs.StableHLO.patchEmbedFlat ic H W P N D Wc bc cls pos
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.patchEmbedBf16 rnd wName bName clsName posName Wc bc cls pos) = Proofs.StableHLO.patchEmbedFlatBf16 rnd ic H W P N D Wc bc cls pos
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.clsSlice = Proofs.StableHLO.clsSliceFlat N x✝
- Proofs.StableHLO.denOp Proofs.StableHLO.BatchableOp.clsPad = Proofs.StableHLO.clsPadFlat N x✝
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.headSlice h) = Proofs.StableHLO.headSliceFlat N heads d h
- Proofs.StableHLO.denOp (Proofs.StableHLO.BatchableOp.headPad h) = Proofs.StableHLO.headPadFlat N heads d h
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
Which BatchNorm a forward chain emits — the batched-index peer of ResNet34Render.R34Bn,
shared by the EfficientNet and MobileNetV2 renders so one traversal can produce both the
training forward and its frozen-stats eval partner.
The distinction is not cosmetic and the §2a bug is what it exists to prevent: a .train chain
reduces its statistics out of the activation (bnBatchF, which couples the batch), a .eval
chain consumes frozen per-channel running stats as graph inputs (the bnEval descriptor, which
does not). A net trained on one and scored with the other is evaluating a different function
— which is exactly what resnet34_fwd did until 2026-07-27, at rel 1.13 on real logits.
- train : BnMode
Training: batch statistics reduced out of the activation (
bnBatchF, reduce[0,2,3], n = B·H·W). What the train step differentiates. - eval : BnMode
Inference: frozen per-channel running stats arriving as graph inputs
%{p}mu/%{p}var(thebnEvaldescriptor). Class-batch-independent.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
AST denotation ⟦·⟧ₐ — our reading of each StableHLO op's spec, over
ℝ, per-example, in primitive terms — independent of dense/Mat.mulVec.
SSA names are ignored.
Equations
- One or more equations did not get rendered due to their size.
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.operand name v) = v
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.dotIn wName W e) = fun (j : Fin x✝) => ∑ i : Fin m, Proofs.StableHLO.den e i * W i j
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.dotInBf16 rnd wName W e) = fun (j : Fin x✝) => ∑ i : Fin m, rnd (Proofs.StableHLO.den e i) * rnd (W i j)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.dotOut wName W e) = fun (i : Fin x✝) => ∑ j : Fin n, W i j * Proofs.StableHLO.den e j
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.addBcast bName b e) = fun (j : Fin x✝) => Proofs.StableHLO.den e j + b j
- Proofs.StableHLO.den e.expe = fun (j : Fin x✝) => Real.exp (Proofs.StableHLO.den e j)
- Proofs.StableHLO.den e.softmaxDiv = fun (j : Fin x✝) => Proofs.StableHLO.den e j / ∑ k : Fin x✝, Proofs.StableHLO.den e k
- Proofs.StableHLO.den (a.sub b) = fun (j : Fin x✝) => Proofs.StableHLO.den a j - Proofs.StableHLO.den b j
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.weightSgd xName wName lrStr x_2 W lr e) = Proofs.Mat.flatten fun (i : Fin m) (j : Fin n) => W i j - lr * (x_2 i * Proofs.StableHLO.den e j)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.biasSgd bName lrStr b lr e) = fun (j : Fin x✝) => b j - lr * Proofs.StableHLO.den e j
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convBiasSgd bName lrStr W x_3 b lr e) = fun (o : Fin x✝) => b o - lr * (Proofs.conv2d_bias_grad_has_vjp W x_3).backward b (Proofs.StableHLO.den e) o
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.weightGrad xName x_2 e) = Proofs.Mat.flatten fun (i : Fin m) (j : Fin n) => x_2 i * Proofs.StableHLO.den e j
- Proofs.StableHLO.den e.biasGrad = Proofs.StableHLO.den e
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convWeightGrad xName b x_2 W e) = (Proofs.conv2d_weight_grad_has_vjp b x_2).backward W.flatten (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convBiasGrad W x_3 b e) = (Proofs.conv2d_bias_grad_has_vjp W x_3).backward b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convStridedWeightGrad xName b x_2 W e) = (Proofs.flatConvStride2_weight_grad_has_vjp b x_2).backward W.flatten (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convStride4WeightGrad xName b x_2 W e) = (Proofs.flatConvStride4_weight_grad_has_vjp b x_2).backward W.flatten (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convStridedBiasGrad W x_3 b e) = (Proofs.flatConvStride2_bias_grad_has_vjp W x_3).backward b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.bnBetaGrad = Proofs.bnPerChannel_grad_beta x✝ (h * w) (Proofs.reassocFwd x✝ h w (Proofs.StableHLO.den e))
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.adamMNextF mName b1Name ob1Name ds β₁ m e) = Proofs.adamMNext β₁ m (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.adamVNextF vName b2Name ob2Name ds β₂ v e) = Proofs.adamVNext β₂ v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.sgdParamF θName lrName ds lr θ e) = Proofs.sgdParam lr θ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.momVNextF vName muName ds μ v e) = Proofs.momVNext μ v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.momParamF θName vName muName lrName ds μ lr θ v e) = Proofs.momParam μ lr θ v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.rmsBufNextF sqName bufName rhoName orhoName muName epsName ds ρ μ ε sq buf e) = Proofs.rmsBufNext ρ μ ε sq buf (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.gradSumSqAccF ds acc e) = fun (x : Fin 1) => Proofs.scalarOf (Proofs.StableHLO.den acc) + Proofs.gradSumSq (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.clipScaleF clipStr epsStr c ε ds s e) = Proofs.clipScale (Proofs.clipFactor c ε (Proofs.scalarOf (Proofs.StableHLO.den s))) (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lambScaleF ds s e) = Proofs.lambScale (Proofs.scalarOf (Proofs.StableHLO.den s)) (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lnGammaSgd gName xName epsStr lrStr ε x_2 γ lr e) = fun (x : Fin 1) => γ 0 - lr * Proofs.bn_grad_gamma n ε x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lnBetaSgd bName lrStr β lr e) = fun (x : Fin 1) => β 0 - lr * Proofs.bn_grad_beta n (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.posEmbedSgd pName lrStr pos lr e) = fun (i : Fin ((N + 1) * D)) => pos.flatten i - lr * Proofs.StableHLO.den e i
- Proofs.StableHLO.den e.patchEmbedBiasGrad = fun (i : Fin x✝) => ∑ p : Fin N, Proofs.StableHLO.batchSlice (N + 1) x✝ (Proofs.StableHLO.den e) p.succ i
- Proofs.StableHLO.den e.posEmbedGrad = fun (i : Fin ((N + 1) * D)) => Proofs.StableHLO.den e i
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.denseBiasSgdB bName lrStr b lr e) = fun (j : Fin x✝) => b j - lr * ∑ n : Fin N, Proofs.StableHLO.batchSlice N x✝ (Proofs.StableHLO.den e) n j
- Proofs.StableHLO.den e.bnBetaGradB = fun (c : Fin x✝) => Proofs.bnPerChannel_grad_beta x✝ (N * (h * w)) (Proofs.bnchwFwd N x✝ h w (Proofs.StableHLO.den e)) c
- Proofs.StableHLO.den e.denseBiasGradB = fun (j : Fin x✝) => ∑ n : Fin N, Proofs.StableHLO.batchSlice N x✝ (Proofs.StableHLO.den e) n j
- Proofs.StableHLO.den e.bnBatchMeanB = fun (c : Fin x✝) => Proofs.bnMean (N * (h * w)) (Proofs.Mat.unflatten (Proofs.bnchwFwd N x✝ h w (Proofs.StableHLO.den e)) c)
- Proofs.StableHLO.den e.bnBatchVarB = fun (c : Fin x✝) => Proofs.bnVar (N * (h * w)) (Proofs.Mat.unflatten (Proofs.bnchwFwd N x✝ h w (Proofs.StableHLO.den e)) c)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.scaleB sStr s e) = fun (i : Fin (N * n)) => Proofs.StableHLO.den e i * s
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.shiftB sStr s e) = fun (i : Fin (N * n)) => Proofs.StableHLO.den e i + s
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.divConstB sStr s e) = fun (i : Fin (N * n)) => Proofs.StableHLO.den e i / s
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.allReduceMeanF R hR t ds g) = fun (i : Fin x✝) => 1 / ↑R * ∑ r : Fin R, Proofs.StableHLO.den (g r) i
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.rowDenseBiasSgd bName lrStr b lr e) = fun (j : Fin x✝) => b j - lr * ∑ n : Fin N, Proofs.StableHLO.batchSlice N x✝ (Proofs.StableHLO.den e) n j
- Proofs.StableHLO.den e.rowDenseBiasGrad = fun (j : Fin x✝) => ∑ n : Fin N, Proofs.StableHLO.batchSlice N x✝ (Proofs.StableHLO.den e) n j
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseBiasGrad W x_3 b e) = fun (o : Fin x✝) => (Proofs.depthwise_bias_grad_has_vjp W x_3).backward b (Proofs.StableHLO.den e) o
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lnGammaGrad xName epsStr ε x_2 e) = fun (x : Fin 1) => Proofs.bn_grad_gamma n ε x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.lnBetaGrad = fun (x : Fin 1) => Proofs.bn_grad_beta n (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.reluF = fun (i : Fin x✝) => max (Proofs.StableHLO.den e i) 0
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.selectPos xName x_3 e) = fun (i : Fin x✝) => if x_3 i > 0 then Proofs.StableHLO.den e i else 0
- Proofs.StableHLO.den e.relu6F = fun (i : Fin x✝) => min (max (Proofs.StableHLO.den e i) 0) 6
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.selectMid xName x_3 e) = fun (i : Fin x✝) => if 0 < x_3 i ∧ x_3 i < 6 then Proofs.StableHLO.den e i else 0
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convertF rnd e) = fun (i : Fin x✝) => rnd (Proofs.StableHLO.den e i)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.flatConvF wName bName W b e) = Proofs.flatConv W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.maxPoolF = Proofs.maxPoolFlat c h w (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.maxPool3s2F = Proofs.maxPool3s2Flat c h w (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convBack wName W b v e) = (Proofs.hasVJP3_to_hasVJP (Proofs.conv2d_has_vjp3 W b)).backward v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.maxPoolBack xName x_2 e) = Proofs.StableHLO.maxPoolBackFlat c h w x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.maxPool3s2Back xName x_2 e) = Proofs.StableHLO.maxPool3s2BackFlat c h w x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnF gName bName epsStr ε γ β e) = Proofs.bnForward x✝ ε γ β (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnBack gName xName epsStr ε γ x_2 e) = Proofs.bn_grad_input x✝ ε γ x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (a.addV b) = fun (j : Fin x✝) => Proofs.StableHLO.den a j + Proofs.StableHLO.den b j
- Proofs.StableHLO.den (a.addVB b) = fun (j : Fin (N * n)) => Proofs.StableHLO.den a j + Proofs.StableHLO.den b j
- Proofs.StableHLO.den (a.subB b) = fun (j : Fin (N * n)) => Proofs.StableHLO.den a j - Proofs.StableHLO.den b j
- Proofs.StableHLO.den e.gapF = Proofs.globalAvgPoolFlat x✝ h w (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.gapBack = (Proofs.globalAvgPoolFlat_has_vjp c h w).backward (fun (x : Fin (c * h * w)) => 0) (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.broadcastBack = fun (k : Fin x✝) => ∑ idx : Fin (x✝ * h * w), if Proofs.flatChannel x✝ h w idx = k then Proofs.StableHLO.den e idx else 0
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.flatConvStridedF wName bName W b e) = Proofs.flatConvStride2 W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.flatConvStridedXlaF wName bName W b e) = Proofs.flatConvStride2Xla W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.flatConvStride4F wName bName W b e) = Proofs.flatConvStride4 W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.convStridedBack wName W b v e) = (Proofs.flatConvStride2_has_vjp W b).backward v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseWeightSgd xName wName lrStr b x_2 W lr e) = Proofs.depthwiseWeightSgdDen b x_2 W lr (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseBiasSgd bName lrStr W x_3 b lr e) = Proofs.depthwiseBiasSgdDen W x_3 b lr (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedWeightSgd xName wName lrStr b x_2 W lr e) = Proofs.depthwiseStridedWeightSgdDen b x_2 W lr (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedBiasSgd bName lrStr W x_3 b lr e) = Proofs.depthwiseStridedBiasSgdDen W x_3 b lr (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedXlaWeightSgd xName wName lrStr b x_2 W lr e) = Proofs.depthwiseStridedXlaWeightSgdDen b x_2 W lr (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedXlaBiasSgd bName lrStr W x_3 b lr e) = Proofs.depthwiseStridedXlaBiasSgdDen W x_3 b lr (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnPerChannelF gName bName epsStr ε γ β e) = Proofs.bnPerChannelTensor3 oc h w ε γ β (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnPerChannelBack gName xName epsStr ε γ x_2 e) = Proofs.bnPerChannelTensor3_grad_input oc h w ε γ x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnPerChannelEvalF gName bName muName varName epsStr ε γ β μ var e) = Proofs.bnPerChannelEvalTensor3 oc h w ε γ β μ var (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseF wName bName W b e) = Proofs.depthwiseFlat W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseBack wName W b v e) = (Proofs.depthwiseFlat_has_vjp W b).backward v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedF wName bName W b e) = Proofs.depthwiseStride2Flat W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedXlaF wName bName W b e) = Proofs.depthwiseStride2FlatXla W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedBack wName W b v e) = (Proofs.depthwiseStride2Flat_has_vjp W b).backward v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.depthwiseStridedXlaBack wName W b v e) = (Proofs.depthwiseStride2FlatXla_has_vjp W b).backward v (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.swishF = Proofs.swish x✝ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.swishBack xName x_2 e) = (Proofs.swish_has_vjp x✝).backward x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.sigmoidF = Proofs.sigmoid x✝ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.sigmoidBack xName x_2 e) = (Proofs.sigmoid_has_vjp x✝).backward x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.maxPoolBackB xName x_2 e) = Proofs.StableHLO.batchMapAux N (Proofs.StableHLO.maxPoolBackFlat c h w) x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.maxPool3s2BackB xName x_2 e) = Proofs.StableHLO.batchMapAux N (Proofs.StableHLO.maxPool3s2BackFlat c h w) x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.selectPosB xName x_2 e) = fun (i : Fin (N * n)) => if x_2 i > 0 then Proofs.StableHLO.den e i else 0
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.selectMidB xName x_2 e) = fun (i : Fin (N * n)) => if 0 < x_2 i ∧ x_2 i < 6 then Proofs.StableHLO.den e i else 0
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.dropPathB mName s e) = Proofs.dropPath N n s (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.dropoutB mName mask e) = Proofs.dropout N n mask (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.swishBackB xName x_2 e) = (Proofs.swish_has_vjp (N * n)).backward x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.geluBackB xName x_2 e) = (Proofs.gelu_has_vjp (N * n)).backward x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (a.matmulFB b) = Proofs.StableHLO.batchMapAux N (Proofs.StableHLO.matMulFlat m k n) (Proofs.StableHLO.den a) (Proofs.StableHLO.den b)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.softmaxRowBackB xName preAct e) = Proofs.StableHLO.batchMapAux N (Proofs.StableHLO.rowSoftmaxBackFlat m n) preAct (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.posEmbedGradB = fun (i : Fin ((tk + 1) * D)) => ∑ b : Fin N, Proofs.StableHLO.batchSlice N ((tk + 1) * D) (Proofs.StableHLO.den e) b i
- Proofs.StableHLO.den e.biasGradB = Proofs.StableHLO.den e
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lnRowBackB gName xName epsStr ε γ x_2 e) = Proofs.StableHLO.batchMapAux N (Proofs.StableHLO.rowLNBackFlat m n ε γ) x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.sigmoidB = Proofs.sigmoid (N * n) (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.sigmoidBackB xName x_2 e) = (Proofs.sigmoid_has_vjp (N * n)).backward x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.geluF = Proofs.gelu x✝ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.geluBack xName x_2 e) = (Proofs.gelu_has_vjp x✝).backward x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.layerScaleF γName γ e) = Proofs.layerScale γ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.layerScaleChF γName γ e) = Proofs.layerScale (fun (k : Fin (c * h * w)) => γ (Proofs.StableHLO.chanIdx c h w k)) (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.softmaxRowF = Proofs.StableHLO.rowSoftmaxFlat m n (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.softmaxRowBack xName preAct e) = Proofs.StableHLO.rowSoftmaxBackFlat m n preAct (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (a.matmulF b) = Proofs.StableHLO.matMulFlat m k n (Proofs.StableHLO.den a) (Proofs.StableHLO.den b)
- Proofs.StableHLO.den e.transposeF = Proofs.StableHLO.transposeFlat m n (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.scaleF sStr s e) = fun (i : Fin x✝) => s * Proofs.StableHLO.den e i
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lnRowF gName bName epsStr ε γ β e) = Proofs.StableHLO.rowLNFlat m n ε γ β (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.lnRowBack gName xName epsStr ε γ x_2 e) = Proofs.StableHLO.rowLNBackFlat m n ε γ x_2 (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.denseRowF wName bName W b e) = Proofs.StableHLO.rowDenseFlat N a c W b (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.denseRowBack wName W e) = Proofs.StableHLO.rowDenseBackFlat N a c W (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.patchEmbedF wName bName clsName posName Wc bc cls pos e) = Proofs.StableHLO.patchEmbedFlat ic H W P N D Wc bc cls pos (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.patchEmbedBack wName Wc e) = Proofs.StableHLO.patchEmbedBackFlat ic H W P N D Wc (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.clsSliceF = Proofs.StableHLO.clsSliceFlat N x✝ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den e.clsPadF = Proofs.StableHLO.clsPadFlat N D (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.headSliceF h e) = Proofs.StableHLO.headSliceFlat N heads d h (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.headPadF h e) = Proofs.StableHLO.headPadFlat N heads d h (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.rowScaleF gName γ e) = Proofs.StableHLO.rowScaleFlat m n γ (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.rowBiasF bName β e) = Proofs.StableHLO.rowBiasFlat m n β (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.batchOp op e) = Proofs.StableHLO.batchMap N (Proofs.StableHLO.denOp op) (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnBatchF gName bName epsStr ε γ β e) = Proofs.StableHLO.bnBatchLA N oc h w ε γ β (Proofs.StableHLO.den e)
- Proofs.StableHLO.den (Proofs.StableHLO.SHlo.bnBatchBack gName xName epsStr ε γ x_2 e) = Proofs.bnBatchTensor4_grad_input N oc h w ε γ x_2 (Proofs.StableHLO.den e)
Instances For
The mixed-precision matmul denotes the EXACT sum over ROUNDED operands. The fp32
accumulate is why the ∑ carries no rounding of its own — the whole deviation from
dotIn sits in the two rnds, which is the structural reason bf16 is the easy twin
of fp8 (no block scale to factor through the sum).
The bundling is inert. dotInBf16 on raw operands denotes exactly what dotIn
denotes on PRE-rounded ones — so every tie already proven in the dotIn vocabulary
(e.g. Bf16PoC.bf16_render_faithful) transfers to the emittable node by rewriting
with this, rather than being reproved.
The round node is den-faithful for any rounding. This is the equation
Proofs/Float/Bf16Fold.lean asks for by name to lift its depth-1 tie to
depth > 1: rounding an intermediate activation is now an in-graph op whose
denotation is exactly post-composition with rnd. No bf16 specifics appear here —
bf16 round-to-nearest is one instance, and the accuracy half is supplied separately
by dense_close_mixed at u_leaf = 2⁻⁸.
The XLA-SAME peer. ⚠ Note it denotes flatConvStride2Xla, NOT flatConvStride2 — the two
tokens have identical types and identical emitted shapes, so this rfl is the only place the
distinction is recorded. Getting it wrong would make the render provably compute one net while
emitting the other.
The XLA-SAME depthwise peer. ⚠ Denotes depthwiseStride2FlatXla, NOT depthwiseStride2Flat
— same caveat as den_batchOp_convStridedXla: this rfl is the only place the two are
distinguished.
Batched inference-BN faithfulness. The bnEval descriptor at the batched index denotes the
proven bnPerChannelEvalTensor3 applied to each example independently, with the same frozen
statistics. That is the formal statement of "eval is class-batch-independent" at N := B: no
N appears on the right except as the number of independent applications, so an example's
logits cannot depend on which others share its batch — unlike bnBatchF, whose den
(bnBatchLA) genuinely couples the batch. Being affine in x, it needs no 0 < ε.
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.
The descriptor form of swish denotes exactly what the descriptor-less swishF denoted at the
same index — the batched graph computes the same function, only the emit width now travels
separately from the batch.
The softmax denominator is PER EXAMPLE — the property this descriptor exists for. Example
k's output divides by example k's own sum, not by the sum over the whole batch.
⚠ This is the half the emit tie structurally cannot see. .softmaxDiv's emitted MLIR was
already per-example (it reduces over dimensions = [1] of tensor<B,n>), so the batched and
per-example forms render byte-for-byte identically and always would — while the descriptor-less
den at index N·n reads v j / ∑ k, v k over ALL N·n coordinates, i.e. it divides by the
batch's total. Same bytes, different function, and only this statement separates them.
ViT increment 1 — the six batch-invariant forms #
⚠ Read the binders: N is the BATCH and tk is ViT's token count. The per-example renderer calls
the token axis N, so these two statements are the place where that name is re-pointed, and
getting them the wrong way round type-checks (both are Nat and both appear multiplied).
⭐ THE CLS SLICE IS THE ONE PLACE THE BATCH AND THE TOKEN AXIS COULD SWAP SILENTLY.
clsSlice takes (tk+1)*D to D — it CONTRACTS — and batchMap N of it takes N*((tk+1)*D)
to N*D. A render that read the batch as the token axis would take (N+1)*D to D, i.e. drop
every example but one and still type-check at N = tk. Stated so the two indices are pinned
apart by a theorem rather than by a naming convention.
The two halves agree, per form. The batched descriptor denotes the batch-lift of exactly
what its per-example peer denotes — stated against den (.lnRowF …) rather than against
rowLNFlat so the claim is "same function as the op the renderer is replacing", which is
what a reader of the swapped render needs. rfl on both sides; kept as five separate
statements because a simp set of five batchMap rewrites is what the whole-net faithfulness
proof will consume.
ViT increment 1's peer of the above, on the form that carries the most data. ⚠ Its per-example
peer takes the TOKEN count as N; this one takes the BATCH as N and the token count as tk,
and both Ns are Nat. Writing the equation out is what makes the two visible at once.
⭐ The batched 3×3/s2 pool forward denotes He et al.'s pool lifted across the batch. ⚠ Read it
beside den_batchOp_maxPool directly above: same type, different function. The two
descriptors are indistinguishable to every structural check the repo has — arity, op counts,
the prefix audit and the shape of the emitted text — which is exactly how the deviation
survived undocumented on every ResNet here. maxPool3s2_ne_maxPool_descr pins them apart.
The two-level contraction is real, and this is what would have been silently lost. At
N = 1 the batched bias gradient collapses to its per-example peer — so a render that dropped
the batch sum type-checks, emits the same bytes and agrees on a one-example batch. The gate
that catches it has to run at N > 1, which is why the emit tie alone is not enough here.
lnRowBackB hands each example its OWN saved activation — the property that forced it to be
a constructor rather than a descriptor, stated so it can be cited instead of re-argued. Example
k's output block is the per-example backward applied to batchSlice k x, never to the whole
x and never to example 0's. A descriptor would give the latter, silently: same types, same
emitted bytes, different function.
sigmoidB denotes Proofs.sigmoid at the batched index — rfl, the same function
sigmoidF_faithful states one index down. This is BCE-with-logits' only new op.
ViT increment 2 — the six forms that cannot be descriptors #
⭐ ATTENTION'S MATMUL IS PER-EXAMPLE IN BOTH OPERANDS, which is the property the whole
matmulF scoping worry was about. Example k's output is Qₖ·Kₖᵀ — its own Q against its
own K — never Q₀ against Kₖ, and never the whole batch flattened into one big matrix.
⚠ All three of those type-check. At the batched index N*(m*k), a den that read the
index as one matrix would compute matMulFlat at the wrong m and still be a Vec; a
descriptor would hand every example operand 0's left factor. What separates them is this
statement, and the emit tie cannot make it — the emitted dot_general carries
batching_dims = [0] x [0] in every one of those worlds.
Each example's softmax backward recomputes from ITS OWN saved scores. The descriptor
version would hand all N example 0's — same types, same bytes, different function.
lnRowBackB's statement, on attention.
⚠⚠ THE BATCH SUM IS INVISIBLE AT N = 1. At one example the outer ∑ b has a single term,
so a render that dropped it type-checks, emits the same bytes and agrees exactly — which is why
any gate on these four must run at N > 1. den_rowDenseBiasGradB_at_one says the same thing
for ConvNeXt's bias gradient; this is ViT's positional embedding, where the shared parameter is
the whole (tk+1) × D table.
Forward logits graph @linear_fwd: broadcast(b) + dot_general(x, W).
Equations
- Proofs.StableHLO.fwdGraph W b x = Proofs.StableHLO.SHlo.addBcast "%b0" b (Proofs.StableHLO.SHlo.dotIn "%W0" W (Proofs.StableHLO.SHlo.operand "%x" x))
Instances For
Dense input-VJP graph (@linear_back): dot_general(dy, W).
Equations
- Proofs.StableHLO.backGraph W dy = Proofs.StableHLO.SHlo.dotOut "%W0" W (Proofs.StableHLO.SHlo.operand "%dy" dy)
Instances For
Softmax-CE loss-cotangent graph softmax(logits) − onehot. The one-hot is
a parameter (a graph input %onehot); den reads it, pretty ignores it.
Equations
- Proofs.StableHLO.lossCotGraph W b x oh = (Proofs.StableHLO.fwdGraph W b x).expe.softmaxDiv.sub (Proofs.StableHLO.SHlo.operand "%onehot" oh)
Instances For
Forward faithfulness. The forward graph denotes mnistLinear W b.
The softmax sub-graph denotes the proven softmax.
Loss-cotangent faithfulness (to the proven gradient). Via
IR.lossCot_bridge: the cotangent graph denotes ∂(crossEntropy)/∂logits
at the linear logits.
Weight-gradient (per-example): the batch-contracting dot_general, i.e.
the outer product x ⊗ dy.
Equations
- Proofs.StableHLO.wGrad x dy = Proofs.Mat.outer x dy
Instances For
Bias-gradient (per-example): the batch reduce-add is the cotangent.
Equations
- Proofs.StableHLO.bGrad dy = dy
Instances For
The emitted weight SGD update W − lr·(x⊗dy), with dy the proven
softmax-CE cotangent.
Equations
- Proofs.StableHLO.sgdW W b x lr label i j = W i j - lr * Proofs.StableHLO.wGrad x (Proofs.StableHLO.den (Proofs.StableHLO.lossCotGraph W b x (Proofs.oneHot n label))) i j
Instances For
The emitted bias SGD update b − lr·dy.
Equations
- Proofs.StableHLO.sgdB W b x lr label j = b j - lr * Proofs.StableHLO.bGrad (Proofs.StableHLO.den (Proofs.StableHLO.lossCotGraph W b x (Proofs.oneHot n label))) j
Instances For
SGD weight-step faithfulness. The emitted update subtracts lr times
the certified ∂/∂W Jacobian contracted with the proven loss cotangent —
plain-SGD optimizer promoted from trusted to proven.
The relu descriptor denotes exactly what the descriptor-less reluF denoted at the same
index: the batched graph computes the same function, only the emit width now travels
separately from the batch. The ResNet-34 peer of den_batchOp_swish_eq_swishF.
Batched ReLU backward faithfulness. selectPosB denotes the same proven
relu_has_vjp_at backward as selectPos, now over the whole batch — which is what the
emitted xName holds. This is the statement that would be FALSE had selectPos been made
a BatchableOp descriptor (that den would apply one example's mask to all N).
ReLU6 backward faithfulness (smooth point). select(0<x<6,·,0) denotes the
proven relu6_has_vjp_at backward — the two-sided kink's mask, smooth iff
x≠0 ∧ x≠6 (both bounds, unlike ReLU's one-sided x≠0).
Batched ReLU6 forward faithfulness (§2f). The relu6 descriptor at the batched index
denotes exactly relu6F's per-example clamp applied across the batch — the MobileNetV2 peer
of den_batchOp_relu_eq_reluF. This is the statement that keeps the emit width off the SHlo
index: at N := B the descriptor emits tensor<B×n>, not tensor<B×(N·n)>.
Batched ReLU6 backward faithfulness. selectMidB denotes the same proven
relu6_has_vjp_at backward as selectMid, now over the whole batch — which is what the
emitted xName holds. FALSE had selectMid been made a BatchableOp descriptor beside
relu6 (that den would apply one example's two-sided mask to all N). Note the smoothness
hypothesis is TWO-sided (x ≠ 0 ∧ x ≠ 6), unlike selectPosB_faithful's x ≠ 0.
Stochastic-depth forward faithfulness. dropPathB denotes Proofs.dropPath, the per-sample
residual-branch scale. rfl, because dropPath is layerScale at a per-example-broadcast
scale and this op is that multiply.
⭐ Stochastic-depth BACKWARD faithfulness — and it is the SAME constructor. A diagonal
linear map is its own transpose, so the renderer emits dropPathB on the cotangent at the same
scale, and that IS the certified VJP. No *Grad peer exists to drift out of step with this one,
which is the whole reason this feature costs one op rather than two.
Classifier-dropout forward faithfulness. dropoutB denotes Proofs.dropout, the
per-ELEMENT inverted mask. rfl, because dropout is layerScale at a mask of the value's own
type — no lift, which is what makes it cheaper than dropPathB rather than dearer.
⭐ Classifier-dropout BACKWARD faithfulness — the SAME constructor, dropPathB_back_faithful
one mask rank up. ⚠ This covers the cotangent flowing THROUGH the site and nothing else; see
Proofs.dropout_vjp_is_self on the classifier weight gradient, which reads the dense's input
and must therefore read the DROPPED activation.
⭐ The ones-mask identity on the AST, which is what licenses emitting the dropout site in
the FORWARD artifact: @efficientnet_do_fwd and @efficientnet_adamdo_train_step are then one
graph differing only in the mask the driver supplies, and the prefix audit survives.
⭐⭐ THE TWO OPS AGREE EXACTLY WHEN THE MASK IS LIFTED, AND THE AST SAYS SO.
Proofs.dropout_of_dropScale at the node level: a dropoutB carrying dropScale N n s denotes
what the dropPathB at s denotes. This is the substitution that would be a silent regulariser
swap if it were made in the other direction on an unlifted mask, and it is stated here so that
the containment is checkable rather than argued.
A dense forward layer graph: broadcast(bias) + dot_general(·, W).
Equations
- Proofs.StableHLO.denseF wN bN W bias e = Proofs.StableHLO.SHlo.addBcast bN bias (Proofs.StableHLO.SHlo.dotIn wN W e)
Instances For
Whole-MLP forward graph dense W₂ ∘ relu ∘ dense W₁ ∘ relu ∘ dense W₀.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Whole-MLP backward (input-VJP) graph: dotOut W₀ ∘ select(p₀) ∘ dotOut W₁ ∘ select(p₁) ∘ dotOut W₂, pᵢ the ReLU pre-activations.
Equations
- One or more equations did not get rendered due to their size.
Instances For
MLP backward faithfulness (smooth point). The backward graph denotes
the proven mlp_has_vjp_at.backward — the per-op dot_general/select
ops assembled into the proven whole-network VJP (cf. IR.mlp_whole_bridge).
bf16 conv forward faithfulness. The bf16 stablehlo.convolution op denotes the
proven flatConv on ROUNDED operands, with the accumulated sum rounded and the bias
added afterwards in f32 — i.e. exactly what the emitted graph computes.
⚠ Contrast flatConvF_faithful, which has no rounding, and dotInBf16, which rounds
the operands but NOT the result. The outer rnd here is not decoration: the emit gives
the convolution a bf16-typed result, so the hardware stores the accumulator rounded.
The bundling is inert at the identity rounding. At rnd = id the bf16 op denotes
exactly what flatConvF does. The dotInBf16_eq_dotIn_rounded analogue: it says the op
adds ROUNDING and nothing else — no reassociation, no dropped bias, no moved padding.
Without it, "the emit is bf16" and "the emit is the same conv" are two separate hopes.
⭐ 3×3/s2 max-pool forward faithfulness. The (flattened) reduce_window(max) op at window
3, stride 2, symmetric padding 1 denotes the proven maxPool3s2Flat — He et al.'s stem pool.
planning/archive/rsb_a3_r50_verified.md §4b.
Conv backward faithfulness. The reversed-kernel stablehlo.convolution
(transpose+reverse+conv) denotes the proven conv input-VJP — the flattened
conv2d_has_vjp3 backward (conv is linear, so this is a global VJP).
Max-pool backward faithfulness (smooth point). The emitted
select_and_scatter graph denotes the proven maxPoolFlat_has_vjp_at
backward — routing the cotangent to each window's argmax (the codegen's
no-ties convention), under the MaxPool smoothness hypothesis.
⭐ 3×3/s2 max-pool backward faithfulness (smooth point). The emitted select_and_scatter
graph at window 3 / stride 2 / symmetric padding 1 denotes the proven
maxPool3s2Flat_has_vjp_at backward, under MaxPool3s2Smooth.
⚠ The hypothesis is stated over positions, not window offsets, and that is not a stylistic
difference from maxPoolBack_faithful: with overlapping windows two offsets can name one input
cell (the clamped duplicate at the first window), where the values are equal by construction
and smoothness must say nothing. maxPool2 has no analogue because there distinct offsets
always meant distinct positions. See MaxPool3s2.lean's header.
BN forward faithfulness. The per-example reduce/normalize/affine graph
(γ·(x−μ)·istd + β, μ/var over the feature axis) denotes the proven
bnForward (BatchNorm.lean).
Residual-add faithfulness (= den_addV). The binary stablehlo.add
denotes pointwise vector addition — the fan-in of a residual/skip
connection. (rfl, so kept out of the axiom audit.)
Strided-conv forward faithfulness. The window_strides=[2,2]
stablehlo.convolution denotes the proven flatConvStride2
(= decimate ∘ stride-1 conv, StridedConv.lean).
The XLA-SAME peer's faithfulness. ⚠ flatConvStride2Xla, NOT flatConvStride2 — identical
types, so this rfl is the only place the distinction is recorded.
Strided-conv input-VJP faithfulness. The zero-upsample (lhs_dilation)
- reversed-kernel conv denotes the proven
flatConvStride2_has_vjpbackward.
Stride-4 conv forward faithfulness. The window_strides=[4,4]
stablehlo.convolution (the ConvNeXt 4×4/s4 patchify stem) denotes the proven
flatConvStride4 (= decimate ∘ decimate ∘ stride-1 conv, StridedConv.lean).
BN backward faithfulness. The consolidated three-term graph denotes the
proven BN input-VJP — equal to the pdiv-contracted Jacobian of bnForward
(bn_input_grad_correct), under 0 < ε. β-independent (a constant shift
does not enter the Jacobian).
Per-channel BN forward faithfulness. The 4-D reshape + per-channel
reduce/normalize (μ/var over the spatial axes [2,3], rank-1 γ/β dims=[1])
denotes the proven bnPerChannelTensor3 (PerChannelBN.lean). (rfl, so kept
out of the axiom audit — roundtrip covers it structurally.)
Dense weight-gradient faithfulness — the outer product xᵢ·dyⱼ.
The gradient ops agree with the SGD ops they were split out of. Each says
den (θSgd …) = θ − lr · den (θGrad …) coordinatewise — so un-fusing the update did not
quietly change the gradient, and anything already proven about a *Sgd output transfers to
θ − lr·(*Grad). All rfl: the *Grad den is literally the subterm.
The TRANSFORMER peers of the same statement — the ViT family §2a left fused, which is why
vit_adam_train_step had no certified render until these existed. Same rfl discipline.
The depthwise BIAS gradients (§2f, MobileNetV2) #
MobileNetV2RenderB is AdamW-only, like ResNet34RenderB — mnv2's SGD render stays at the
per-example index, so there is deliberately no fused depthwise{,Strided}BiasSgdB peer and hence
no *SgdB_eq_grad statement to make. What pins these two ops instead is that den IS the
shared-parameter batch sum of the proven per-example depthwise bias VJP, which is what the emitted
reduce … [0, 2, 3] computes. The emit side is covered separately by the byte-PREFIX case in
tests/TestBatchedEmitTie.lean against the per-example fused depthwiseBiasSgd.
The ConvNeXt five — same statement, the last *Sgd/*Grad pairs the kit was missing (§2f) #
den (xSgd …) = θ − lr · den (xGrad …), all rfl. Together with the emit-side byte-PREFIX checks
in tests/TestBatchedEmitTie.lean this is what lets convnext_adam_train_step hand its gradients
to adamWParamF instead of to the SGD tail — the fusion was the blocker, never Adam (§2a).
Stride-4 weight-gradient faithfulness (ConvNeXt's patchify stem). den IS the proven
flatConvStride4_weight_grad_has_vjp backward. There is no fused convStride4WeightSgd peer —
nothing but ConvNeXt's stem is stride-4, and its AdamW render consumes the un-fused gradient
directly — so this, not a *Sgd_eq_grad statement, is what pins the op's den.
XLA-SAME strided-conv weight-SGD faithfulness. The per-example op's den IS the
proven flatConvStride2Xla_weight_grad_has_vjp descent step. There is no per-example
convStridedXlaWeightGrad token to factor through (only the batched …B one exists), so this
pins the den directly, as convStride4WeightGrad_faithful does.
XLA-SAME strided-conv bias-SGD faithfulness. Same reduce text as convBiasSgd; the
den is the flatConvStride2Xla bias VJP.
den (xSgdB …) = θ − lr · den (xGradB …) — the BATCHED peers of the *Sgd_eq_grad set #
All rfl, and all carrying the same content as §2a's per-example eight: the fused *SgdB op IS
θ − lr· applied to the un-fused gradient, so handing the gradient to AdamW instead of to the SGD
tail changes nothing about what is computed. This is what unblocks a batched resnet34_adam_train_step
rendered from Proofs/ — the blocker was the fusion, never Adam.
AdamW parameter-step faithfulness. The emitted 26-op block denotes exactly
Proofs.adamWParam of the child's gradient — the theorem that moves the optimizer from a
trusted hand-written emitter (ViTRender.emitAdamV, which only claimed to be op-for-op
adamWParam) into the proven kit. Well-definedness of the √v̂ + ε denominator is
Proofs.adam_denom_pos; there is deliberately no descent claim, because Adam is not a
monotone descent method (AMSGrad counterexample).
The rendered AdamW triple is Proofs.adamWStep. Bundles the three ops into the
(θ', m', v') a train step returns per parameter — the whole optimizer, denoted.
Rendered plain SGD is Proofs.sgdParam — θ − lr·g with lr a runtime arg.
Rendered Nesterov velocity is Proofs.momVNext — v' = μ·v + g.
Rendered Nesterov update is Proofs.momParam — θ' = θ − lr·(g + μ·v').
The rendered Nesterov pair is Proofs.momStep. The momentum analogue of
adamW_triple_faithful: the (θ', v') a momentum train step returns per parameter, denoted.
The m slot is a passthrough and so appears nowhere here — that is the packed-[θ|m|v]
signature being shared verbatim with the AdamW render, not an omission.
μ = 0 makes the rendered Nesterov update the rendered SGD update. Ties the two new op
families to each other at the denotation level, so the mom and sgd renders provably agree
in the limit rather than merely looking similar.
Rendered RMSProp buffer is Proofs.rmsBufNext — b' = μ·b + g/√(ρ·s + (1−ρ)·g² + ε),
TensorFlow's ε placement.
The rendered RMSProp triple is Proofs.rmsPropStep. The RMSProp analogue of
adamW_triple_faithful / mom_pair_faithful: (θ', b', s') as the three ops the render
actually emits, denoted together.
▶ Read the composition off this statement — it is the whole "one new op" claim, checked:
the parameter slot is sgdParamF applied to this op's SSA output (.operand, so the buffer
is emitted once and threaded, per §4's no-CSE rule), and the mean-square slot is the EXISTING
adamVNextF at β₂ := ρ. Only rmsBufNextF is new.
The mean-square slot really is the Adam op. adamVNextF at β₂ := ρ denotes RMSProp's
s', so reusing it is licensed rather than assumed — the emit-side twin of
Proofs.rmsSqNext_eq_adamVNext, and the reason this optimizer cost ONE op and not three.
μ = 0 makes the rendered RMSProp buffer the bare normalised gradient. The mu_zero
bridge momParamF_mu_zero provides for Nesterov, at the denotation level.
The scalar fold is Proofs.gradSumSq accumulated — acc + ∑ᵢ gᵢ² for one parameter,
reduced to a rank-0 scalar. SHlo 1 denoting a rank-0 tensor<f32> is lnBetaGrad's
established reading, not a new convention.
▶ This op is what makes the global reduction an ordinary SHlo TREE. The norm reads like a
shared DAG node — one scalar consumed by 200 sites — and SHlo is a tree; the resolution is
that SHlo is single-OUTPUT, not single-INPUT, so folding 200 subtrees into one scalar is just
a left-nested chain of this constructor, seeded at %zero. Nothing is recomputed, because every
gradient it consumes is already an .operand leaf.
lambDirF denotes Proofs.lambDir — rfl, i.e. the rendered LAMB direction IS the ℝ
definition, structurally. Same bar as adamWParamF_faithful.
lambScaleF denotes Proofs.lambScale. ⚠ The trust ratio is computed from THIS tensor's
own norm, which is what makes it layer-wise; clipScaleF's factor is shared across every
parameter. The two ops look alike and differ in exactly that quantifier.
The rescale is Proofs.clipScale at Proofs.clipFactor of the summed total — the
reference's g * jnp.minimum(1.0, CLIP / (gn + 1e-6)) with gn = sqrt(total).
⚠ The factor is derived from the op's FIRST CHILD, the already-summed global total, so this
constructor cannot express a per-parameter clip: it never receives enough to compute one. The
c/ε ℝ fields pair with clipStr/epsStr exactly as bnF's ε/epsStr do.
⚠ The factor is recomputed at every site rather than emitted once and threaded, for
adamWParamF's reason — SHlo is single-result, so each output is its own node, and XLA's CSE
folds the duplicates (§2b-bis measured that on R34's 108 → 36 rsqrt at no run-time cost).
▶ THE WHOLE CLIP, END TO END, FOR TWO PARAMETERS — this is the transcription check.
Read the reference's two lines off the right-hand side: gn = √(Σ_leaves Σ g²) folded from
%zero, then g * min(1, CLIP/(gn + 1e-6)). Stated at TWO parameters because one cannot
exhibit the property that matters — see clipShared_faithful. Holds by rfl.
Below the threshold the rendered clip is the EXACT identity, so a clip-on render at a large
c must agree with the clip-off render on every byte (x * 1.0 is exact in binary32). The
emit-side reading of Proofs.clipGrad_id_below, and the licence for clip-tie's gate 3.
⚠ It is also why gate 3 alone is not evidence: at factor 1 a per-parameter clip and a global one
are the SAME FUNCTION, so an identity gate cannot see which was rendered.
Inference per-channel BN forward faithfulness. The 4-D reshape + affine
γ·(x−μ)·rsqrt(var+ε)+β with rank-1 μ/var/γ/β (dims=[1]) denotes the proven
bnPerChannelEvalTensor3 (PerChannelBN.lean). (rfl, so kept out of the axiom audit.)
Per-channel BN backward faithfulness. The block-diagonal three-term graph
(per-channel, reducing over the spatial axes) denotes the proven per-channel BN
input-VJP — equal to the pdiv-contracted (block-diagonal) Jacobian of
bnPerChannelTensor3 (bnPerChannelTensor3_grad_input_correct), under 0 < ε.
Depthwise-conv forward faithfulness. The feature_group_count = c
stablehlo.convolution (with a [c,1,kH,kW] kernel, one filter per channel)
denotes the proven depthwiseFlat (= flatten ∘ depthwiseConv2d ∘ unflatten,
Depthwise.lean). (rfl, so kept out of the axiom audit — roundtrip covers it
structurally.)
Depthwise-conv input-VJP faithfulness. The reversed-kernel depthwise
stablehlo.convolution (reverse the per-channel filters over the spatial axes
[2,3]; the channel groups are 1×1 so no o↔i transpose, same
feature_group_count = c) denotes the proven depthwiseFlat_has_vjp backward
(depthwise is linear, so this is a global VJP).
Strided-depthwise forward faithfulness. The window_strides=[2,2],
feature_group_count = c stablehlo.convolution denotes the proven
depthwiseStride2Flat (= decimate ∘ stride-1 depthwise, Depthwise.lean).
Strided-depthwise input-VJP faithfulness. The zero-upsample (stablehlo.pad
interior=1) + reversed-kernel stride-1 depthwise denotes the proven
depthwiseStride2Flat_has_vjp backward.
XLA-SAME strided-depthwise input-VJP faithfulness. depthwiseStridedBack's text with
the transposed-conv pad at [p+1, p-1]; denotes the proven depthwiseStride2FlatXla_has_vjp
backward (= scatter onto the ODD positions, then the stride-1 depthwise input-VJP).
XLA-SAME strided-depthwise weight-SGD faithfulness. den IS the
depthwiseStride2Xla_weight_grad_has_vjp descent step (through the non-reducing
depthwiseStridedXlaWeightSgdDen wrapper, Depthwise.lean).
XLA-SAME strided-depthwise bias-SGD faithfulness.
Swish input-VJP faithfulness. The closed-form dy ⊙ σ(x)·(1 + x·(1−σ(x)))
graph (recomputing σ from the saved pre-activation x) denotes the proven GLOBAL
swish_has_vjp backward (dy ⊙ swishScalarDeriv x; swish is smooth everywhere, so
this is a global VJP — no smoothness hypothesis).
Sigmoid forward faithfulness. The stablehlo.logistic(x) graph denotes the
proven sigmoid (= σ(x), EfficientNet.lean) — the SE gate's output nonlinearity.
Smooth everywhere. (rfl, so kept out of the axiom audit — roundtrip covers it.)
Sigmoid input-VJP faithfulness. The closed-form dy ⊙ σ(x)·(1−σ(x)) graph
(recomputing σ from the saved pre-activation x) denotes the proven GLOBAL
sigmoid_has_vjp backward (dy ⊙ sigmoidScalarDeriv x; sigmoid is smooth
everywhere, so this is a global VJP — no smoothness hypothesis).
Per-channel layer-scale faithfulness. The [c]-broadcast multiply denotes
the proven layerScale at the channel-expanded vector. (rfl.)
GELU input-VJP faithfulness. The closed-form dy ⊙ gelu'(x) graph
(recomputing tanh(u(x)) from the saved pre-activation x) denotes the proven
GLOBAL gelu_has_vjp backward (dy ⊙ geluScalarDeriv x; GELU is smooth
everywhere, so this is a global VJP — no smoothness hypothesis).
Row-softmax forward faithfulness. The per-row exp / reduce[last] / divide
graph denotes rowSoftmaxFlat (= flattened rowSoftmax, Attention.lean). Plain
exp/sum, no max-shift (matches the proven softmax). Smooth everywhere.
(rfl, so kept out of the axiom audit — roundtrip covers it structurally.)
Row-softmax input-VJP faithfulness. The per-row closed-form
p ⊙ (dy − ⟨p,dy⟩) graph (recomputing p from the saved pre-softmax scores)
denotes rowSoftmaxBackFlat (= flattened rowSoftmax_has_vjp_mat.backward).
Softmax is smooth, so this is a global VJP — no smoothness hypothesis.
Matrix-multiply faithfulness. The reshape + batching-dim-0 dot_general
(contracting [2] x [1]) + reshape graph denotes matMulFlat (= the flattened
Mat.mul). Bilinear; the attention backwards reuse this token (dA = dC·Bᵀ,
dB = Aᵀ·dC). (rfl, so kept out of the axiom audit — roundtrip covers it
structurally.)
Transpose faithfulness. stablehlo.transpose dims=[0,2,1] (after reshape
to rank 3) denotes transposeFlat (= the flattened Mat.transpose). (rfl.)
Row-LayerNorm forward faithfulness. The rank-3 reduce[2]/normalize/affine
graph (per token row, scalar γ/β) denotes rowLNFlat (rowwise bnForward =
rowwise layerNormForward, definitionally). (rfl.)
Row-LayerNorm input-VJP faithfulness. The per-row consolidated three-term
graph (recomputing x̂/istd from the saved pre-LN input, reductions over the row
axis) denotes rowLNBackFlat (rowwise bn_grad_input — faithful to the
pdiv-Jacobian per row under 0 < ε, bn_input_grad_correct).
Per-token dense forward faithfulness. The dot_general [2] x [0] + bias
broadcast dims=[2] graph denotes rowDenseFlat (rowwise dense W b). (rfl.)
Per-token dense input-VJP faithfulness. The dot_general [2] x [1] graph
(dy against W's output axis) denotes rowDenseBackFlat (rowwise Mat.mulVec W
= the proven dense_has_vjp backward; dense is affine — global VJP).
Patch-embedding faithfulness. The stride-P VALID conv + channels-last
flatten + CLS concatenate + position-embed add graph denotes patchEmbedFlat
(the local re-spelling of the proven patchEmbed_flat; the tie is rfl in
ViTFwdGraph). (rfl, coarse-token like seBlock.)
Patch-embedding input-VJP faithfulness. The reversed-kernel strided
conv_transpose (on the patch-token rows of the [N+1,D] cotangent) denotes
patchEmbedBackFlat (= the proven patchEmbed_input_grad_formula; the tie to
patchEmbed_flat_has_vjp.backward is rfl in ViTBackB0). (rfl.)
CLS-slice faithfulness. The row-0 stablehlo.slice denotes clsSliceFlat
(= the proven cls_slice_flat). (rfl.)
CLS-pad faithfulness. The zero-pad scatter-to-row-0 denotes clsPadFlat
(= the proven cls_slice_flat_has_vjp.backward; linear — global VJP). (rfl.)
Per-head slice faithfulness. The feature-axis stablehlo.slice of head h's
contiguous column block denotes headSliceFlat (= mhsa_layer's per-head column
gather). Linear reindex. (rfl.)
Per-head pad faithfulness. The feature-axis zero-pad into head h's column
block denotes headPadFlat (the slice's VJP; summed over heads it is
mhsa_layer's concat). Linear. (rfl.)
Row-broadcast scale faithfulness. The reshape + broadcast-γ-over-rows +
multiply graph denotes rowScaleFlat (rowwise layerScale γ). Diagonal-linear —
its own input-VJP, so the backward reuses this token on the cotangent. (rfl.)
Row-broadcast bias faithfulness. The broadcast-β-over-rows + add graph denotes
rowBiasFlat. Translation — identity input-VJP. (rfl.)
Whole MNIST-CNN forward graph:
dense ∘ relu ∘ dense ∘ relu ∘ dense ∘ maxPool ∘ relu ∘ conv ∘ relu ∘ conv.
Equations
- One or more equations did not get rendered due to their size.
Instances For
CNN forward faithfulness. The forward graph denotes the proven
mnistCnnNoBnForward.
Whole CIFAR-CNN forward graph (Chapter 4): two conv→relu→conv→relu→maxPool
stages (channels ic→c1→c1, then c1→c2→c2) then dense→relu→dense→relu→dense.
The Chapter-4 peer of cnnFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
CIFAR-CNN forward faithfulness. The forward graph denotes the proven
cifarCnnForward.
Whole BN-CIFAR forward graph (Chapter 4, BatchNorm variant): each conv is
followed by a per-example bnF before its ReLU. epsStr is the shared ε
literal; the four BN layers carry scalar γ/β inputs %g{i}/%bt{i}.
Equations
- One or more equations did not get rendered due to their size.
Instances For
BN-CIFAR forward faithfulness. The forward graph denotes the proven
cifarCnnBnForward.
Whole deeper (8-conv) CIFAR-CNN forward graph: four conv→relu→conv→relu→maxPool
stages (channels ic→c1→c1, c1→c2→c2, c2→c3→c3, c3→c4→c4) then
dense→relu→dense→relu→dense. The 4-stage peer of cifarFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Deeper (8-conv) CIFAR-CNN forward faithfulness. The forward graph denotes the
proven cifarCnn8Forward.
Whole deeper (8-conv) BN-CIFAR forward graph: each of the eight convs is followed
by a per-channel bnPerChannelF before its ReLU. epsStr is the shared ε literal; the
eight BN layers carry per-channel γ/β inputs %g{i}/%bt{i}. The 4-stage peer of
cifarBnFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Deeper (8-conv) BN-CIFAR forward faithfulness. The forward graph denotes the
proven cifarCnnBn8Forward.
Whole ResNet-style forward graph (Chapter 5): the structure the proven
whole-net VJP cnn_has_vjp_at already covers —
dense ∘ GAP ∘ rblkP ∘ rblk ∘ maxPool ∘ cbr(stem). The stem is convBnRelu
(SAME conv on the 2h×2w input), one maxpool to h×w, an identity basic
block (rblk: relu(F(y)+y)), a projection basic block (rblkP:
relu(proj(y)+F(y)), c→oc), global-average-pool, then dense. Each block's
skip reuses the block-input subtree in BOTH addV operands, so the graph
stays a tree (the §7 "tree-safe via operand leaves" trick, generalized to a
computed input). epsStr is the shared ε literal; each BN carries scalar γ/β
SSA inputs (%g*/%bt*). The Chapter-5 peer of cifarBnFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ResNet-style forward faithfulness. The forward graph denotes the proven
cnnForward — the net whose whole-network VJP is cnn_has_vjp_at (discharged
unconditionally by CnnConcrete.cnnConcrete_has_vjp_correct). The residual
addVs denote the + of residual/residualProj (biPath); each skip's
duplicated subtree denotes the same block-input value, so den reads it
twice and the fan-in is exact.
Whole MobileNetV2 forward graph (representative, ch7 peer of resnetFwdGraph):
stem (conv→bn→relu6) → skip inverted-residual addV(invresBody, stem) → no-skip
inverted-residual → global-average-pool → dense. Each inverted-residual body is
bn∘conv(project) ∘ relu6∘bn∘depthwise ∘ relu6∘bn∘conv(expand); the skip's addV
reuses the block-input subtree (linear bottleneck — no relu6 after the add). Uses the
MobileNetV2 ops relu6F/depthwiseF (SAME-spatial representative; the stride-2
depthwiseStridedF/flatConvStridedF of the full render are exercised at the op level,
not assembled here — full strided graph deferred, see planning doc). epsStr = shared ε
literal; each scalar BN carries γ/β SSA inputs %g*/%bt*.
Equations
- One or more equations did not get rendered due to their size.
Instances For
MobileNetV2 forward faithfulness. The representative forward graph denotes the
proven mobilenetv2Forward (whose end-to-end VJP at a smooth point is
mobilenetv2_has_vjp_at). The skip addV denotes the + of residual/biPath;
the inverted-residual body's bn/conv/depthwise/relu6 ops denote
invresBody = ivProject ∘ ivDepthwise ∘ ivExpand. ch7 peer of resnetFwdGraph_faithful.
Whole MobileNetV2 forward graph at the FULL ch7 render dims (3×224² → 7×7×64):
strided stem (flatConvStridedXlaF, 224→112) → 6 inverted-residual blocks (b1/b3/b5/b6
stride-2 downsample via depthwiseStridedXlaF, b2/b4 stride-1 SAME with an addV skip)
→ 1×1 conv-bn-relu6 head → global-avg-pool → dense. Concrete (not symbolic) peer of
mobilenetv2FwdGraph, tied to the full forward mobilenetv2Forward_full. Scalar BN.
⚠ The five stride-2 sites read the XLA-SAME (odd) phase, like every other MobileNetV2
graph since 2026-09-05; this one is the scalar-BN stepping stone mobilenetv2FwdGraphFullPC
replaced, and writes no artifact.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full MobileNetV2 forward faithfulness. The full strided render graph denotes the
proven mobilenetv2Forward_full (the representative 6-block net, tied by
mobilenetv2Rep_denote_eq in SpecVJP.lean — the committed 17-block spec's tie is
mobilenetv2Verified_denote_eq there, against mobilenetv2ForwardPaper). simp-based
— so unlike the VJP fold it does not hit the concrete-dim isDefEq wall.
Whole ConvNeXt forward graph (representative, ch9 peer of resnetFwdGraph): 1×1
patchify conv → stem-LN → 2 residual ConvNeXt blocks (depthwise → LN → 1×1 expand →
GELU → 1×1 project → layerScale, then addV skip) → GAP → head-LN → dense. Scalar LN
(= bnForward, via bnF); uses geluF + the new layerScaleF. Denotes the proven
convNextForward.
Equations
- One or more equations did not get rendered due to their size.
Instances For
ConvNeXt forward faithfulness. The representative forward graph denotes the proven
convNextForward. Scalar LN (layerNormForward = bnForward); simp-based.
Pointwise-VJP backwards are unique: .correct pins backward to the
pdiv-contracted Jacobian, so any two HasVJPAt f x agree on backward.
Lets us swap the maxpool's flatten∘unflatten transport (built into
mnistCnnNoBn_has_vjp_at) for the cast-free witness below.
Max-pool VJP at a raw flattened point (no flatten ∘ unflatten index), so
it composes without a transport cast; backward is maxPoolBackFlat. The
correct field reuses maxPoolFlat_has_vjp_at.correct, aligning the point
via Tensor3.flatten_unflatten.
Equations
- Proofs.StableHLO.maxPoolFlat_has_vjp_at' v hs = { backward := Proofs.StableHLO.maxPoolBackFlat c h w v, correct := ⋯ }
Instances For
Whole MNIST-CNN backward (input-VJP) graph, reversing cnnFwdGraph:
convBack W₁ ∘ select(a₁) ∘ convBack W₂ ∘ select(a₂) ∘ maxPoolBack ∘ dotOut W₃ ∘ select(a₃) ∘ dotOut W₄ ∘ select(a₄) ∘ dotOut W₅, with aᵢ the
ReLU pre-activations and the conv/maxpool saved inputs threaded as in §4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tensor-type string tensor<d₀x…xf32>.
Equations
- Proofs.StableHLO.ty dims = "tensor<" ++ "x".intercalate (List.map toString dims ++ ["f32"]) ++ ">"
Instances For
Boolean (i1) tensor-type string, for compare/select masks.
Equations
- Proofs.StableHLO.tyI1 dims = "tensor<" ++ "x".intercalate (List.map toString dims ++ ["i1"]) ++ ">"
Instances For
bf16 tensor-type string, for the convertF round node (planning/archive/bf16_renderer.md).
Only the round trip uses it today; when a bf16-operand dot_general lands (rung 2+)
this is the type its operands carry.
Equations
- Proofs.StableHLO.tyBf16 dims = "tensor<" ++ "x".intercalate (List.map toString dims ++ ["bf16"]) ++ ">"
Instances For
fp8 peer of tyBf16. E4M3 only — planning/archive/cifar_lowprec_stability.md §2.3 measured
that f8E5M2 compiles, lowers to a plain __cublas$lt$matmul, and leaves ZERO f8e5m2
values in the optimized HLO: the type is silently widened away. Only E4M3 reaches the fp8
units on sm_89, so there is deliberately no E5M2 spelling here.
Equations
- Proofs.StableHLO.tyF8 dims = "tensor<" ++ "x".intercalate (List.map toString dims ++ ["f8E4M3FN"]) ++ ">"
Instances For
SSA name ↦ the [c,h,w] the value bound to that name really carries. See liftPointwise.
⚠⚠ Keyed by NAME, not by flat width — and that is not a refinement, it is the whole
correctness of the table. A width table collides whenever two layers have the same element
count, and on the real nets they do: ConvNeXt-T's stage-2 MLP is 1536·14·14 = 301056 and its
stage-0 block is 96·56·56 = 301056; stage 3's 3072·7·7 equals stage 1's 192·28·28. First
writer won, so 24 of ConvNeXt's pointwise blocks unflattened to a shape with the right element
count and the wrong layout — which is not a wrong program (the bracket is still an inverse
reshape pair) but is exactly the relayout the bracket exists to remove. Measured: 2.434 GB of
transposes and 84.45 ms/step keyed by width, 0.122 GB and 68.28 ms keyed by name.
Newest entry first, and no dedup: fresh never reuses a name, so a lookup for a value the
previous token produced hits the head of the list.
⚠⚠ The Bool is the value's LAYOUT: true means this is the map's row view [h·w, c]
rather than the map [c, h, w]. It is not bookkeeping — it is what makes ConvNeXt's channel-LN
transparent. That chain is transpose → lnRow → rowScale → rowBias → transpose, a layout ROUND
TRIP whose two ends are the same [c,h,w] map; without the flag the closing transpose's result
has no entry, the drop-path multiply that consumes it falls back to flat, and every pointwise op
after it on the residual chain goes with it — 0.223 GB of relayout against 0.122 (measured,
ConvNeXt-T bf16). And liftPointwise must NOT fire on a row view: [h·w, c] reshaped to
[B,c,h,w] is a DIFFERENT permutation, not an inverse pair, so that one would be a wrong
program rather than a slow one.
Instances For
Emitter state: the fresh-name counter, plus the name ↦ [c,h,w] table.
⚠ The table lives in the STATE rather than in a pretty argument because a net renderer
calls pretty once per graph FRAGMENT — a conv and the activation that consumes it land in
different calls — and only the state is threaded across them.
Equations
Instances For
The 3×3/s2 pool's emitted forward text, given already-freshened names.
⚠⚠ It is a shared helper rather than two copies for the reason sWGradGeom is (§2f-bis): the
per-example .maxPool3s2F and the batched BatchableOp.maxPool3s2 are two emitTok arms
emitting one program, and a window or padding that drifted between them would be a pair of
renders that agree on every structural check and compute different functions — which is the
exact failure this whole op exists to fix. With one writer they cannot drift, and
TestBatchedEmitTie then measures rather than assumes it.
window_dimensions = 3, window_strides = 2, padding = [[1,1],[1,1]] on the spatial axes: He
et al./torchvision MaxPool2d(3, stride=2, padding=1), window i = input [2i−1, 2i+1].
⚠ NOT XLA 'SAME', which pads (0,1) and slides the grid one input position — the two are
different functions everywhere.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The 3×3/s2 pool's emitted backward text, given already-freshened names. Shared by the
per-example and batched arms, for maxPool3s2FwdText's reason.
⭐ Only the window attributes differ from maxPoolBack's emit — nothing else — because
select_and_scatter's scatter region already reduces with add, which is exactly the
accumulation overlapping windows need. The emitter was general enough before the op existed.
⚠ %sa/%sb/%sc/%sd are hardcoded region block arguments and are therefore RESERVED SSA
names (§4): a top-level value of the same name is a redefinition error that surfaces only at
XLA compile time.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The stochastic-depth mask input name for ramp index i — the mName a dropPathB carries,
and the tensor<Bxf32> the signature declares for it.
⚠ It lives HERE, beside the emitter, rather than in one net's renderer, because the spelling is
load-bearing in three places that must agree and only one of them is Lean: dropPathP's emit
reads it as an operand, every SD render's signature declares it, and
scripts/misplace_drop_sites.py matches %dp\d+ textually to build the placement control.
A second definition would be the double-writer disease with a committed shell script as the
third writer. (It started in EfficientNetRender.lean and moved when ConvNeXt needed it too;
both renderers are in this namespace, so no call site changed and no artifact byte moved.)
Equations
- Proofs.StableHLO.dpName i = toString "%dp" ++ toString i
Instances For
The classifier-dropout mask input name — the mName a dropoutB carries, and the
tensor<B×n×f32> the signature declares for it.
⚠⚠ IT IS DELIBERATELY NOT %dp{i}-SHAPED, and that is not cosmetic.
scripts/misplace_drop_sites.py builds the stochastic-depth placement control by matching
%dp\d+ textually; a dropout input spelled %dp9 would be swept into that rewrite, silently
changing a control's meaning on a render it was never written for. Handoff §0.11 records the
other half of this hazard on ViT — a control that quietly does nothing reads exactly like a
control that ran — and the cheap defence is a name the SD tooling cannot match.
grep -c '%do' verified_mlir/*.mlir is 0 across every committed artifact.
Equations
- Proofs.StableHLO.doName = "%do"
Instances For
The renderable skeleton of an SHlo graph: opcodes + shapes + leaf SSA
names, with ℝ operand values and the shape index erased — exactly what
reaches the emitted text.
- operand (name : String) (n : ℕ) : Raw
- dotIn (w : String) (m n : ℕ) : Raw → Raw
- dotInBf16 (w : String) (m n : ℕ) : Raw → Raw
- dotOut (w : String) (m n : ℕ) : Raw → Raw
- addBcast (b : String) (n : ℕ) : Raw → Raw
- expe (n : ℕ) : Raw → Raw
- softmaxDiv (n : ℕ) : Raw → Raw
- sub (n : ℕ) : Raw → Raw → Raw
- weightSgd (xName wName lrStr : String) (m n : ℕ) : Raw → Raw
- biasSgd (bName lrStr : String) (n : ℕ) : Raw → Raw
- convWeightSgd (xName wName lrStr : String) (ic oc h w kH kW : ℕ) : Raw → Raw
- convBiasSgd (bName lrStr : String) (oc h w : ℕ) : Raw → Raw
- bnGammaSgd (gName vName epsStr lrStr : String) (oc h w : ℕ) : Raw → Raw
- bnBetaSgd (bName lrStr : String) (oc h w : ℕ) : Raw → Raw
- layerScaleChGammaSgd (gName xName lrStr : String) (c h w : ℕ) : Raw → Raw
- lnGammaSgd (gName xName epsStr lrStr : String) (n : ℕ) : Raw → Raw
- lnBetaSgd (bName lrStr : String) (n : ℕ) : Raw → Raw
- veclnGammaSgd (gName xName epsStr lrStr : String) (N D : ℕ) : Raw → Raw
- patchEmbedWeightSgd (wName xName lrStr : String) (ic H W P N D : ℕ) : Raw → Raw
- reluF (n : ℕ) : Raw → Raw
- selectPos (x : String) (n : ℕ) : Raw → Raw
- relu6F (n : ℕ) : Raw → Raw
- selectMid (x : String) (n : ℕ) : Raw → Raw
- convertF (n : ℕ) : Raw → Raw
- flatConvF (w b : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- flatConvFBf16 (w b : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- maxPoolF (c h w : ℕ) : Raw → Raw
- convBack (w : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- maxPoolBack (x : String) (c h w : ℕ) : Raw → Raw
- bnF (g b eps : String) (n : ℕ) : Raw → Raw
- bnBack (g x eps : String) (n : ℕ) : Raw → Raw
- addV (n : ℕ) : Raw → Raw → Raw
- gapF (c h w : ℕ) : Raw → Raw
- gapBack (c h w : ℕ) : Raw → Raw
- broadcastBack (c h w : ℕ) : Raw → Raw
- flatConvStridedF (w b : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- flatConvStridedXlaF (w b : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- convStridedBack (w : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- convStridedWeightSgd (xName wName lrStr : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- depthwiseWeightSgd (xName wName lrStr : String) (c h w' kH kW : ℕ) : Raw → Raw
- depthwiseStridedWeightSgd (xName wName lrStr : String) (c h w' kH kW : ℕ) : Raw → Raw
- convStridedXlaWeightSgd (xName wName lrStr : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- depthwiseStridedXlaWeightSgd (xName wName lrStr : String) (c h w' kH kW : ℕ) : Raw → Raw
- flatConvStride4F (w b : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- bnPerChannelF (g b eps : String) (oc h w : ℕ) : Raw → Raw
- bnPerChannelBack (g x eps : String) (oc h w : ℕ) : Raw → Raw
- bnPerChannelEvalF (g b mu var eps : String) (oc h w : ℕ) : Raw → Raw
- weightGrad (x : String) (m n : ℕ) : Raw → Raw
- biasGrad (n : ℕ) : Raw → Raw
- convWeightGrad (x : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- convBiasGrad (ic oc h w' kH kW : ℕ) : Raw → Raw
- convStridedWeightGrad (x : String) (ic oc h w' kH kW : ℕ) : Raw → Raw
- bnGammaGrad (v eps : String) (oc h w' : ℕ) : Raw → Raw
- bnBetaGrad (oc h w' : ℕ) : Raw → Raw
- adamMNextF (m b1 ob1 : String) (ds : List ℕ) : Raw → Raw
- adamVNextF (v b2 ob2 : String) (ds : List ℕ) : Raw → Raw
- adamWParamF (θ m v b1 ob1 b2 ob2 bc1 bc2 lr eps wd : String) (ds : List ℕ) : Raw → Raw
- sgdParamF (θ lr : String) (ds : List ℕ) : Raw → Raw
- momVNextF (v mu : String) (ds : List ℕ) : Raw → Raw
- momParamF (θ v mu lr : String) (ds : List ℕ) : Raw → Raw
- rmsBufNextF (sq buf rho orho mu eps : String) (ds : List ℕ) : Raw → Raw
- gradSumSqAccF (ds : List ℕ) : Raw → Raw → Raw
- clipScaleF (clipStr epsStr : String) (ds : List ℕ) : Raw → Raw → Raw
- lambDirF (θ m v b1 ob1 b2 ob2 bc1 bc2 eps wd : String) (ds : List ℕ) : Raw → Raw
- lambScaleF (ds : List ℕ) : Raw → Raw → Raw
- depthwiseF (w b : String) (c h w' kH kW : ℕ) : Raw → Raw
- depthwiseBack (w : String) (c h w' kH kW : ℕ) : Raw → Raw
- depthwiseStridedF (w b : String) (c h w' kH kW : ℕ) : Raw → Raw
- depthwiseStridedXlaF (w b : String) (c h w' kH kW : ℕ) : Raw → Raw
- depthwiseStridedBack (w : String) (c h w' kH kW : ℕ) : Raw → Raw
- depthwiseStridedXlaBack (w : String) (c h w' kH kW : ℕ) : Raw → Raw
- swishF (n : ℕ) : Raw → Raw
- swishBack (x : String) (n : ℕ) : Raw → Raw
- sigmoidF (n : ℕ) : Raw → Raw
- sigmoidBack (x : String) (n : ℕ) : Raw → Raw
- geluF (n : ℕ) : Raw → Raw
- geluBack (x : String) (n : ℕ) : Raw → Raw
- layerScaleF (γ : String) (n : ℕ) : Raw → Raw
- layerScaleChF (γ : String) (c h w : ℕ) : Raw → Raw
- softmaxRowF (m n : ℕ) : Raw → Raw
- softmaxRowBack (x : String) (m n : ℕ) : Raw → Raw
- matmulF (m k n : ℕ) : Raw → Raw → Raw
- transposeF (m n : ℕ) : Raw → Raw
- scaleF (s : String) (n : ℕ) : Raw → Raw
- lnRowF (g b eps : String) (m n : ℕ) : Raw → Raw
- lnRowBack (g x eps : String) (m n : ℕ) : Raw → Raw
- denseRowF (w b : String) (N a c : ℕ) : Raw → Raw
- denseRowBack (w : String) (N a c : ℕ) : Raw → Raw
- patchEmbedF (w b cls pos : String) (ic H W P N D : ℕ) : Raw → Raw
- clsSliceF (N D : ℕ) : Raw → Raw
- clsPadF (N D : ℕ) : Raw → Raw
- headSliceF (N heads d hIdx : ℕ) : Raw → Raw
- headPadF (N heads d hIdx : ℕ) : Raw → Raw
- rowScaleF (g : String) (m n : ℕ) : Raw → Raw
- rowBiasF (b : String) (m n : ℕ) : Raw → Raw
- batched (tag : String) (names : List String) (info : List ℕ) : Raw → Raw
- batched2 (tag : String) (names : List String) (info : List ℕ) : Raw → Raw → Raw
- allReduceMean (R : ℕ) (t : String) (ds : List ℕ) : Raw → Raw
Instances For
Instances For
Equations
- Proofs.StableHLO.instReprRaw = { reprPrec := Proofs.StableHLO.instReprRaw.repr }
Equations
The (tag, names, info) skeleton descriptor of a batched per-example op — the
discriminator + the SSA names the emit references + the shape dims. Keeps the
batchOp skel one line and isolates the 7-variant match into a pure function.
Equations
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.conv wN bN W bias) = ("conv", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convStrided wN bN W bias) = ("convStrided", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convBf16 rnd wN bN W bias) = ("convBf16", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convF8 rnd wN bN W bias) = ("convF8", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convStridedBf16 rnd wN bN W bias) = ("convStridedBf16", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convStridedXla wN bN W bias) = ("convStridedXla", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convStridedXlaBf16 rnd wN bN W bias) = ("convStridedXlaBf16", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.depthwise wN bN W bias) = ("depthwise", [wN, bN], [N, c, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.depthwiseBf16 rnd wN bN W bias) = ("depthwiseBf16", [wN, bN], [N, c, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.depthwiseStrided wN bN W bias) = ("depthwiseStrided", [wN, bN], [N, c, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.depthwiseStridedBf16 rnd wN bN W bias) = ("depthwiseStridedBf16", [wN, bN], [N, c, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.depthwiseStridedXla wN bN W bias) = ("depthwiseStridedXla", [wN, bN], [N, c, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.depthwiseStridedXlaBf16 rnd wN bN W bias) = ("depthwiseStridedXlaBf16", [wN, bN], [N, c, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.dense wN bN W bias) = ("dense", [wN, bN], [N, a, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.gap = ("gap", [], [N, b, h, w])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.seBlock w1 b1 w2 b2 W₁ b₁ W₂ b₂) = ("seBlock", [w1, b1, w2, b2], [N, c, h, w, r])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.bnEval gN bN muN varN es ε γ β μ var) = ("bnEval", [gN, bN, muN, varN, es], [N, oc, h, w])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.swish = ("swish", [], [N, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.relu = ("relu", [], [N, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.relu6 = ("relu6", [], [N, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.maxPool = ("maxPool", [], [N, c, h, w])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.maxPool3s2 = ("maxPool3s2", [], [N, c, h, w])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.softmaxRow = ("softmaxRow", [], [N, m, n])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.denseRowBack wN W) = ("denseRowBackP", [wN], [N, rows, a_2, c])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.denseRowBackBf16 rnd wN W) = ("denseRowBackPBf16", [wN], [N, rows, a_2, c])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.gelu = ("gelu", [], [N, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.transpose = ("transposeP", [], [N, m, n])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convStride4 wN bN W bias) = ("convStride4P", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.convStride4Bf16 rnd wN bN W bias) = ("convStride4PBf16", [wN, bN], [N, ic, oc, h, w, kH, kW])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.layerScaleCh gN γ) = ("layerScaleChP", [gN], [N, c, h, w])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.dotOut wN W) = ("dotOutP", [wN], [N, b, a])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.expe = ("expeP", [], [N, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.softmaxDiv = ("softmaxDivP", [], [N, b])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.lnRow gN bN es ε γ β) = ("lnRowP", [gN, bN, es], [N, m, n])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.rowScale gN γ) = ("rowScaleP", [gN], [N, m, n])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.rowBias bN β) = ("rowBiasP", [bN], [N, m, n])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.denseRow wN bN W b_2) = ("denseRowP", [wN, bN], [N, tk, a_2, c])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.denseRowBf16 rnd wN bN W b_2) = ("denseRowPBf16", [wN, bN], [N, tk, a_2, c])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.patchEmbed wN bN clsN posN Wc bc cls pos) = ("patchEmbedP", [wN, bN, clsN, posN], [N, ic, H, W, P, tk, D])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.patchEmbedBf16 rnd wN bN clsN posN Wc bc cls pos) = ("patchEmbedPBf16", [wN, bN, clsN, posN], [N, ic, H, W, P, tk, D])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.clsSlice = ("clsSliceP", [], [N, tk, b])
- Proofs.StableHLO.batchOpDescr N Proofs.StableHLO.BatchableOp.clsPad = ("clsPadP", [], [N, tk, a])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.headSlice h) = ("headSliceP", [], [N, tk, heads, d, ↑h])
- Proofs.StableHLO.batchOpDescr N (Proofs.StableHLO.BatchableOp.headPad h) = ("headPadP", [], [N, tk, heads, d, ↑h])
Instances For
One serialized token: an opcode with shapes/names; operands are positional.
- operand (name : String) (n : ℕ) : Tok
- dotIn (w : String) (m n : ℕ) : Tok
- dotInBf16 (w : String) (m n : ℕ) : Tok
- dotOut (w : String) (m n : ℕ) : Tok
- addBcast (b : String) (n : ℕ) : Tok
- expe (n : ℕ) : Tok
- softmaxDiv (n : ℕ) : Tok
- sub (n : ℕ) : Tok
- weightSgd (xName wName lrStr : String) (m n : ℕ) : Tok
- biasSgd (bName lrStr : String) (n : ℕ) : Tok
- convWeightSgd (xName wName lrStr : String) (ic oc h w kH kW : ℕ) : Tok
- convBiasSgd (bName lrStr : String) (oc h w : ℕ) : Tok
- bnGammaSgd (gName vName epsStr lrStr : String) (oc h w : ℕ) : Tok
- bnBetaSgd (bName lrStr : String) (oc h w : ℕ) : Tok
- layerScaleChGammaSgd (gName xName lrStr : String) (c h w : ℕ) : Tok
- lnGammaSgd (gName xName epsStr lrStr : String) (n : ℕ) : Tok
- lnBetaSgd (bName lrStr : String) (n : ℕ) : Tok
- veclnGammaSgd (gName xName epsStr lrStr : String) (N D : ℕ) : Tok
- patchEmbedWeightSgd (wName xName lrStr : String) (ic H W P N D : ℕ) : Tok
- reluF (n : ℕ) : Tok
- selectPos (x : String) (n : ℕ) : Tok
- relu6F (n : ℕ) : Tok
- selectMid (x : String) (n : ℕ) : Tok
- convertF (n : ℕ) : Tok
- flatConvF (w b : String) (ic oc h w' kH kW : ℕ) : Tok
- flatConvFBf16 (w b : String) (ic oc h w' kH kW : ℕ) : Tok
- maxPoolF (c h w : ℕ) : Tok
- convBack (w : String) (ic oc h w' kH kW : ℕ) : Tok
- maxPoolBack (x : String) (c h w : ℕ) : Tok
- bnF (g b eps : String) (n : ℕ) : Tok
- bnBack (g x eps : String) (n : ℕ) : Tok
- addV (n : ℕ) : Tok
- gapF (c h w : ℕ) : Tok
- gapBack (c h w : ℕ) : Tok
- broadcastBack (c h w : ℕ) : Tok
- flatConvStridedF (w b : String) (ic oc h w' kH kW : ℕ) : Tok
- flatConvStridedXlaF (w b : String) (ic oc h w' kH kW : ℕ) : Tok
- convStridedBack (w : String) (ic oc h w' kH kW : ℕ) : Tok
- convStridedWeightSgd (xName wName lrStr : String) (ic oc h w' kH kW : ℕ) : Tok
- depthwiseWeightSgd (xName wName lrStr : String) (c h w' kH kW : ℕ) : Tok
- depthwiseStridedWeightSgd (xName wName lrStr : String) (c h w' kH kW : ℕ) : Tok
- convStridedXlaWeightSgd (xName wName lrStr : String) (ic oc h w' kH kW : ℕ) : Tok
- depthwiseStridedXlaWeightSgd (xName wName lrStr : String) (c h w' kH kW : ℕ) : Tok
- flatConvStride4F (w b : String) (ic oc h w' kH kW : ℕ) : Tok
- bnPerChannelF (g b eps : String) (oc h w : ℕ) : Tok
- bnPerChannelBack (g x eps : String) (oc h w : ℕ) : Tok
- bnPerChannelEvalF (g b mu var eps : String) (oc h w : ℕ) : Tok
- weightGrad (x : String) (m n : ℕ) : Tok
- biasGrad (n : ℕ) : Tok
- convWeightGrad (x : String) (ic oc h w' kH kW : ℕ) : Tok
- convBiasGrad (ic oc h w' kH kW : ℕ) : Tok
- convStridedWeightGrad (x : String) (ic oc h w' kH kW : ℕ) : Tok
- bnGammaGrad (v eps : String) (oc h w' : ℕ) : Tok
- bnBetaGrad (oc h w' : ℕ) : Tok
- adamMNextF (m b1 ob1 : String) (ds : List ℕ) : Tok
- adamVNextF (v b2 ob2 : String) (ds : List ℕ) : Tok
- adamWParamF (θ m v b1 ob1 b2 ob2 bc1 bc2 lr eps wd : String) (ds : List ℕ) : Tok
- sgdParamF (θ lr : String) (ds : List ℕ) : Tok
- momVNextF (v mu : String) (ds : List ℕ) : Tok
- momParamF (θ v mu lr : String) (ds : List ℕ) : Tok
- rmsBufNextF (sq buf rho orho mu eps : String) (ds : List ℕ) : Tok
- gradSumSqAccF (ds : List ℕ) : Tok
- clipScaleF (clipStr epsStr : String) (ds : List ℕ) : Tok
- lambDirF (θ m v b1 ob1 b2 ob2 bc1 bc2 eps wd : String) (ds : List ℕ) : Tok
- lambScaleF (ds : List ℕ) : Tok
- depthwiseF (w b : String) (c h w' kH kW : ℕ) : Tok
- depthwiseBack (w : String) (c h w' kH kW : ℕ) : Tok
- depthwiseStridedF (w b : String) (c h w' kH kW : ℕ) : Tok
- depthwiseStridedXlaF (w b : String) (c h w' kH kW : ℕ) : Tok
- depthwiseStridedBack (w : String) (c h w' kH kW : ℕ) : Tok
- depthwiseStridedXlaBack (w : String) (c h w' kH kW : ℕ) : Tok
- swishF (n : ℕ) : Tok
- swishBack (x : String) (n : ℕ) : Tok
- sigmoidF (n : ℕ) : Tok
- sigmoidBack (x : String) (n : ℕ) : Tok
- geluF (n : ℕ) : Tok
- geluBack (x : String) (n : ℕ) : Tok
- layerScaleF (γ : String) (n : ℕ) : Tok
- layerScaleChF (γ : String) (c h w : ℕ) : Tok
- softmaxRowF (m n : ℕ) : Tok
- softmaxRowBack (x : String) (m n : ℕ) : Tok
- matmulF (m k n : ℕ) : Tok
- transposeF (m n : ℕ) : Tok
- scaleF (s : String) (n : ℕ) : Tok
- lnRowF (g b eps : String) (m n : ℕ) : Tok
- lnRowBack (g x eps : String) (m n : ℕ) : Tok
- denseRowF (w b : String) (N a c : ℕ) : Tok
- denseRowBack (w : String) (N a c : ℕ) : Tok
- patchEmbedF (w b cls pos : String) (ic H W P N D : ℕ) : Tok
- clsSliceF (N D : ℕ) : Tok
- clsPadF (N D : ℕ) : Tok
- headSliceF (N heads d hIdx : ℕ) : Tok
- headPadF (N heads d hIdx : ℕ) : Tok
- rowScaleF (g : String) (m n : ℕ) : Tok
- rowBiasF (b : String) (m n : ℕ) : Tok
- batched (tag : String) (names : List String) (info : List ℕ) : Tok
- batched2 (tag : String) (names : List String) (info : List ℕ) : Tok
- allReduceMean (R : ℕ) (t : String) (ds : List ℕ) : Tok
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Proofs.StableHLO.instReprTok = { reprPrec := Proofs.StableHLO.instReprTok.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Postorder serialization: children, then the node's opcode token.
Equations
- One or more equations did not get rendered due to their size.
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.operand a a_1) = [Proofs.StableHLO.Tok.operand a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.dotIn a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.dotIn a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.dotInBf16 a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.dotInBf16 a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.dotOut a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.dotOut a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.addBcast a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.addBcast a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.expe a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.expe a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.softmaxDiv a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.softmaxDiv a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.sub a a_1 a_2) = Proofs.StableHLO.toToks a_1 ++ Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.sub a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.weightSgd a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.weightSgd a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.biasSgd a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.biasSgd a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.convBiasSgd a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.convBiasSgd a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnGammaSgd a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.bnGammaSgd a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnBetaSgd a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.bnBetaSgd a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.layerScaleChGammaSgd a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.layerScaleChGammaSgd a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.lnGammaSgd a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.lnGammaSgd a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.lnBetaSgd a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.lnBetaSgd a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.veclnGammaSgd a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.veclnGammaSgd a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.reluF a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.reluF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.selectPos a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.selectPos a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.relu6F a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.relu6F a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.selectMid a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.selectMid a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.convertF a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.convertF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.flatConvF a a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8) = Proofs.StableHLO.toToks a_8 ++ [Proofs.StableHLO.Tok.flatConvF a a_1 a_2 a_3 a_4 a_5 a_6 a_7]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.flatConvFBf16 a a_1 a_2 a_3 a_4 a_5 a_6 a_7 a_8) = Proofs.StableHLO.toToks a_8 ++ [Proofs.StableHLO.Tok.flatConvFBf16 a a_1 a_2 a_3 a_4 a_5 a_6 a_7]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.maxPoolF a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.maxPoolF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.convBack a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.convBack a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.maxPoolBack a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.maxPoolBack a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.bnF a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnBack a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.bnBack a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.addV a a_1 a_2) = Proofs.StableHLO.toToks a_1 ++ Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.addV a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.gapF a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.gapF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.gapBack a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.gapBack a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.broadcastBack a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.broadcastBack a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.convStridedBack a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.convStridedBack a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnPerChannelF a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.bnPerChannelF a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnPerChannelBack a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.bnPerChannelBack a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.weightGrad a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.weightGrad a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.biasGrad a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.biasGrad a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.convWeightGrad a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.convWeightGrad a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.convBiasGrad a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.convBiasGrad a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnGammaGrad a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.bnGammaGrad a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.bnBetaGrad a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.bnBetaGrad a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.adamMNextF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.adamMNextF a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.adamVNextF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.adamVNextF a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.sgdParamF a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.sgdParamF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.momVNextF a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.momVNextF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.momParamF a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.momParamF a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.rmsBufNextF a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.rmsBufNextF a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.gradSumSqAccF a a_1 a_2) = Proofs.StableHLO.toToks a_1 ++ Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.gradSumSqAccF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.clipScaleF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_3 ++ Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.clipScaleF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.lambScaleF a a_1 a_2) = Proofs.StableHLO.toToks a_1 ++ Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.lambScaleF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.depthwiseF a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.depthwiseF a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.depthwiseBack a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.depthwiseBack a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.depthwiseStridedF a a_1 a_2 a_3 a_4 a_5 a_6 a_7) = Proofs.StableHLO.toToks a_7 ++ [Proofs.StableHLO.Tok.depthwiseStridedF a a_1 a_2 a_3 a_4 a_5 a_6]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.depthwiseStridedBack a a_1 a_2 a_3 a_4 a_5 a_6) = Proofs.StableHLO.toToks a_6 ++ [Proofs.StableHLO.Tok.depthwiseStridedBack a a_1 a_2 a_3 a_4 a_5]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.swishF a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.swishF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.swishBack a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.swishBack a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.sigmoidF a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.sigmoidF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.sigmoidBack a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.sigmoidBack a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.geluF a a_1) = Proofs.StableHLO.toToks a_1 ++ [Proofs.StableHLO.Tok.geluF a]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.geluBack a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.geluBack a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.layerScaleF a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.layerScaleF a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.layerScaleChF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.layerScaleChF a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.softmaxRowF a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.softmaxRowF a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.softmaxRowBack a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.softmaxRowBack a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.matmulF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_3 ++ Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.matmulF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.transposeF a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.transposeF a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.scaleF a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.scaleF a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.lnRowF a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.lnRowF a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.lnRowBack a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.lnRowBack a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.denseRowF a a_1 a_2 a_3 a_4 a_5) = Proofs.StableHLO.toToks a_5 ++ [Proofs.StableHLO.Tok.denseRowF a a_1 a_2 a_3 a_4]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.denseRowBack a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.denseRowBack a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.clsSliceF a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.clsSliceF a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.clsPadF a a_1 a_2) = Proofs.StableHLO.toToks a_2 ++ [Proofs.StableHLO.Tok.clsPadF a a_1]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.headSliceF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.headSliceF a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.headPadF a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.headPadF a a_1 a_2 a_3]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.rowScaleF a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.rowScaleF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.rowBiasF a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.rowBiasF a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.batched a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.batched a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.batched2 a a_1 a_2 a_3 a_4) = Proofs.StableHLO.toToks a_3 ++ Proofs.StableHLO.toToks a_4 ++ [Proofs.StableHLO.Tok.batched2 a a_1 a_2]
- Proofs.StableHLO.toToks (Proofs.StableHLO.Raw.allReduceMean a a_1 a_2 a_3) = Proofs.StableHLO.toToks a_3 ++ [Proofs.StableHLO.Tok.allReduceMean a a_1 a_2]
Instances For
The full entry — [c,h,w] plus the row-view flag — recorded for SSA name nm.
Equations
Instances For
The [c,h,w] nm carries as a map. A row view answers none: it holds the same elements
in a different order, so unflattening it to [B,c,h,w] would not be an inverse pair.
Equations
Instances For
Record nm as carrying the [c,h,w] MAP (not a row view).
Equations
Instances For
The [c,h,w] the running table has for the value bound to nm, as a map.
Equations
- Proofs.StableHLO.lookupShapeM nm = do let __x ← get match __x with | (fst, tbl) => pure (Proofs.StableHLO.lookupShape tbl nm)
Instances For
Record what one token's operand and result carry, given the operand-name stack before and
after it was emitted. Called from serializeToks, so no emitTok arm has to know about the
table — which is what keeps the 94 arms free of it.
⭐ Three cases, and the first two exist only for the channel-LN round trip: a transpose FLIPS
the layout flag when its (m,n) match the operand's [c,h,w] (and records nothing when they
do not, e.g. ViT's attention transposes, which are not maps at all), and the row ops carry it
through unchanged. Everything else reads its shapes off the tag.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Render a pointwise block at its 4-D shape when the OPERAND's producer recorded one.
k receives the (possibly unflattened) input name and the dims to type its ops with, and
returns (text, result name).
⚠ The c*h*w == n guard is what keeps a mismatched entry from emitting an ill-typed reshape
rather than merely a suboptimal one. It cannot fire today — an entry is written by the token
that produced the name — and it is the difference between a missed optimisation and a render
that does not parse, so it stays.
⭐ The block's own RESULT is recorded too, which is what lets a pointwise CHAIN stay 4-D: the value crossing the token boundary keeps its flat type, so without this the second op in a swish→multiply→add chain would find nothing for its operand and drop back to flat.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Two-tensor-operand peer of liftPointwise; both operands carry the same flat width.
The shape comes from whichever operand has one — the cotangent first, since it is the stack
operand and was produced nearby, then the saved activation.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The text of the cross-replica mean — ViTRender.emitGradAllReduce's body, verbatim, so
that the allReduceMean token re-renders every committed *dp* artifact byte-identically.
all_reduce(add) over replica_groups = [[0..R-1]], then a divide by R; the names are
%arsum{t} … %armean{t} from the tag rather than fresh. At R ≤ 1 there is no text and
the operand's name is the result, exactly as the text function did.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Render one token: pop its operands' result-names off the stack, emit its
StableHLO line(s), push its fresh result name. The per-op StableHLO syntax
here is the audited lexical boundary (validated by iree-compile + GPU run);
the structure it consumes is the proven-faithful token stream.
Instances For
Fold a token stream to accumulated (code, result-name-stack).
Equations
- One or more equations did not get rendered due to their size.
- Proofs.StableHLO.serializeToks B [] x✝ = pure x✝
Instances For
The conv-bias SSA name — §2l step B. Every conv in ResNet-34 is immediately followed by
BatchNorm, and BN subtracts the batch mean, so in ℝ a conv bias cannot reach the BN output and
its gradient is identically zero. He et al.'s .convBn therefore carries no conv bias, and
this repo's render did — 8,512 parameters the reference does not have (§2k).
With convBias := false the bias operand becomes a zero CONSTANT rather than a function
argument: the op is the same proven flatConvF/flatConvStridedF at bias = 0, so den and
every faithfulness theorem are untouched, and x + 0.0 is exact in IEEE, so the forward is
bit-identical to the biased render fed zeros. What changes is the signature.
⚠ MEASURED, and it corrects §2l's stated reason: in f32 the gradient is NOT exactly zero — the
BN mean is a rounded sum, leaving a residue ~1e-6 of the conv-weight gradient — and under
AdamW's scale-free update that residue still moves θ by ~lr per step. In the 80-epoch run all
8,512 biases drifted to |θ|max 0.041. They are safe to drop because the FORWARD does not depend
on them (zeroing all of them moves the trained logits by rel 1e-6, against 0.79 for the same
ablation on BN β), not because they stay zero. See tests/TestConvBiasZero.lean.
Equations
Instances For
The bias's slot in a return-name list, gated the way biasName gates the operand: with
convBias := false no bias SGD op is emitted, so the slot must LEAVE the list rather than carry
the empty string the if convBias then … else pure ("", "") idiom hands back.
⚠ This exists because leaving it in is silent twice over. An empty name renders
return %a, , %b — malformed text, but only the lowerer ever sees it; and the name list keeps
its FULL length, so an arity #guard on the signature still passes. Measured on the first swap
attempt: mobilenetv2_train_step at convBias := false returned 210 names (52 of them empty)
against 160 types. Use this at every site where a names := [...] list is built from gated ops.
Instances For
The zero-bias constants the convBias := false render consumes, one per channel width used as
a conv bias. Emitted once at the top of the body; XLA folds the resulting add.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fixed-6-decimal float literal, so a computed smoothing constant emits in the SAME textual form
the hand-written literals used and nClasses = 10 re-renders byte-identical.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Fixed-12-decimal float literal, for constants fmt6 would destroy.
⚠ It exists because fmt6 is not a formatting preference, it is a PRECISION CEILING, and small
derived constants fall straight through it. Gradient accumulation's second-moment coefficient is
(1−β₂)/K²; at K = 4 that is 6.25e-5, which fmt6 emits as 0.000063 — 0.8% wrong, in a
baked literal, in the optimizer, where nothing downstream would question it. Same class as §2k's
hardcoded 0.010000 label-smoothing mass. fmt6 stays the default so every committed artifact
re-renders byte-identically; this is for constants that need the room.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The label-smoothing mass per class, α/K. α = 0.1 throughout; K is nClasses.
⚠ This was hardcoded 0.010000 — correct at K = 10 and WRONG at every other K, and it sat
in the COTANGENT, not just in the report-only %loss. At nClasses = 1000 it made the smoothing
term 100× too large: it removes 10.0 of probability mass instead of 0.1, i.e. a different
objective, silently. Caught 2026-07-30 by the first ImageNet smoke run reporting loss ≈ 87 where
1000-class CE at init must be ≈ ln(1000) = 6.9 — the number was implausible, and that is the only
reason it surfaced. Nothing in the repo's proofs covers it: α is a literal in emitted text,
which is exactly the carve-out class §5 says needs its own numeric check, and §2b's %loss bug
is the standing precedent for it going wrong unnoticed.
Equations
- Proofs.StableHLO.alphaOverK nClasses alpha = Proofs.StableHLO.fmt6 (alpha / nClasses.toFloat)
Instances For
1 − α, the ON-class weight of label-smoothed CE. Emitted beside alphaOverK, because the two
always move together and splitting them is how one of them gets updated alone.
Equations
- Proofs.StableHLO.oneMinusAlpha alpha = Proofs.StableHLO.fmt6 (1.0 - alpha)
Instances For
1 − ρ, the RMSProp mean-square mixing weight. Derived from ρ, never written as a second
literal beside it — the oneMinusAlpha precedent, and the K-constant lesson (§2k): any
emitted constant that depends on a hyperparameter must be DERIVED, because the copy is what
gets left behind when the original moves. Five copies of one label-smoothing constant were
found across four nets in a single session for exactly this reason.
Equations
- Proofs.StableHLO.oneMinusRho rho = Proofs.StableHLO.fmt6 (1.0 - rho)
Instances For
Which optimizer tail a whole-net render emits. .adamw is every net's committed default and
reproduces the existing artifacts byte-identically; .rmsprop is what the MobileNetV2 and
EfficientNet ImageNet references actually use (planning/archive/recipe_gaps.md v1.2).
Lives here rather than in either renderer because both need it: a per-net copy of a
two-constructor choice is the double-writer disease one level down, in code — the same argument
vitBackAll/enetBackAll exist for (§2a-quater). Each renderer threads it through ONE
traversal, so gate 1 applies for free: at .adamw every committed artifact must re-render
byte-identical.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
The RMSProp hyperparameters, as the JAX reference configs state them. ρ/μ are 0.9 on both
nets that use this optimizer; ε and wd are what differ, and ε differs in the way that
matters most (see Proofs.rmsBufNext_eps_placement_at_zero).
- rho : Float
rmspropDecay— the running mean-square decay. - mu : Float
momentum— μ for the buffer on the normalised gradient. - eps : Float
rmspropEps— ⚠ emitted INSIDE the square root (TensorFlow), not added to the root. - wd : Float
COUPLED L2 (folded into the gradient), not AdamW's decoupled decay.
Instances For
ρ / (1−ρ) / μ / ε / wd as graph constants — the RMSProp peer of each renderer's adamConsts
block. %lr stays a runtime tensor<f32> arg so one graph serves a whole LR schedule.
Equations
- One or more equations did not get rendered due to their size.
Instances For
MobileNetV2's RMSProp knobs (jax/MainMobilenetV2Imagenet.lean): ε = 1.0.
Equations
- Proofs.StableHLO.mnv2RmsHyper = { eps := 1.0, wd := 40e-6 }
Instances For
EfficientNet-B0's RMSProp knobs (jax/MainEfficientNetImagenet.lean): ε = 1e-3.
Equations
- Proofs.StableHLO.enetRmsHyper = { eps := 10e-4, wd := 10e-6 }
Instances For
pretty — render an SHlo graph to StableHLO, now defined as
serialize ∘ toToks ∘ skel: tokenize the graph (postorder), then print the
tokens. The emitter shares ONE structured form with the parser, so the
round-trip parse (toToks (skel a)) = skel a (StableHLOParse.lean) is about
the very tokens this prints — the printer can't structurally drift.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The cross-replica gradient mean as pretty of the allReduceMeanF node — the drop-in
for ViTRender.emitGradAllReduce in every batched render (4d piece 2, 2026-09-07), measured
byte-identical on every committed *dp* artifact. At replicas ≤ 1 it emits nothing and
threads the gradient's name, exactly as the text function did. The R operand graphs are
all .operand grad at a zero placeholder, because a render is value-independent — skel
erases values — while the family is what den sums over in the tie.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The full @linear_train_step rendered from the verified AST: forward +
softmax-CE cotangent come from pretty (lossCotGraph …) (the %onehot
operand value is pretty-irrelevant, so any placeholder renders the same
text — at runtime %onehot is a graph input); the weight grad
(dot_general over the batch axis), bias grad (reduce), and the SGD
multiply/subtract updates are appended. Returns the two updated params.
The verified-AST peer of IRPrint.linearTrainStepModule.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The linear train step rendered ENTIRELY from the verified AST. Unlike
linearTrainStepModuleV (forward via pretty, tail hand-written), here the
whole module is pretty of denoted nodes: the cotangent (lossCotGraph,
rendered once → shared %dy), then the two fused SGD ops weightSgd/biasSgd
that consume %dy. So every emitted line is pretty(provenNode) and
LinearFold proves the two outputs' den = the certified loss-descent
SGD step. The lr ℝ / operand values are skel-erased (render is
value-independent), so placeholders here render identically to the live graph
the den theorems use.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@mlp_fwd rendered from the verified forward AST mlpFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@cnn_fwd rendered from the verified CNN forward AST cnnFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@cifar_fwd rendered from the verified CIFAR forward AST cifarFwdGraph.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full MLP SGD train step. The forward layers emit exactly mlpFwdGraph's
ops (dot_general+add, maximum), saving the pre-activations %h0,%h1;
the backward emits mlpBackGraph's ops (dot_general, compare GT+select
masks reading %h0,%h1); param grads + SGD as in the linear step. Each piece
is proven faithful above (mlpFwdGraph_faithful, mlpBackGraph_faithful,
reluF_faithful, selectPos_faithful, wGrad/bGrad_is*Jacobian,
lossCotGraph_isCEgrad, sgd*_isCertifiedGradStep); the assembly/naming
is the renderer (validated by iree-compile + the GPU run).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full CNN SGD train step (@cnn_train_step), the ch4 peer of
mlpTrainStepText. Architecture (= mnistCnnNoBnForward):
conv W₁ → relu → conv W₂ → relu → maxpool → flatten → dense W₃ → relu → dense W₄ → relu → dense W₅. Each mathematical op is a rendering of a
proof-backed piece:
- forward conv/maxpool/dense/relu —
flatConvF_faithful,maxPoolF_faithful,denseF_faithful,reluF_faithful(andcnnFwdGraph_faithfulfor the whole); - loss cotangent
%dy = softmax(logits) − onehot—lossCotGraph_isCEgrad; - backward dense (
dot_general, contract output axis) + relu masks (compare GT+select) —mlpBackGraph_faithful/selectPos_faithful; - maxpool backward (
select_and_scatter, GE/add, route dy to the window argmax) —maxPoolBack_faithful; conv input-VJP (transpose+reverse+conv) —convBack_faithful; - dense W/b grads (
dot_generalover batch /reduce) —wGrad/bGrad; - conv weight grad — the transpose trick (
conv2d_weight_grad_has_vjp): the SAMEstablehlo.convolutionwith the batch axis as the contraction feature; rendered here, validated by the GPU run (aconvWGrad_faithfultheorem is optional polish, see §B2 of the handoff); - SGD
θ' = θ − lr·∇—sgd*_isCertifiedGradStep. The op text mirrors the GPU-validated emitter (emitTok) byte-for-byte for conv/maxpool/convBack/select_and_scatter; assembly + SSA naming is the renderer.lr = 0.1/B(grads sum over the batch).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full CIFAR CNN SGD train step (@cifar_train_step), the Chapter-4 peer of
cnnTrainStepText. Architecture (= cifarCnnForward):
conv 3→32 → relu → conv 32→32 → relu → maxpool → conv 32→64 → relu → conv 64→64 → relu → maxpool → flatten → dense 4096→512 → relu → dense 512→512 → relu → dense 512→10 + softmax-CE. Two conv→conv→pool
stages at two spatial sizes (H×W then H/2×W/2), with channel changes.
Every mathematical op is the SAME proof-backed render as cnnTrainStepText,
just instantiated at more layers / two spatial scales — forward
conv/maxpool/dense/relu (cifarFwdGraph_faithful); loss cotangent
(lossCotGraph_isCEgrad); backward dense (dot_general) + relu masks
(selectPos_faithful); maxpool backward (select_and_scatter,
maxPoolBack_faithful); conv input-VJP (transpose+reverse+conv,
convBack_faithful); dense W/b grads; conv weight grad (transpose trick);
SGD θ' = θ − lr·∇. The per-op text mirrors the GPU-validated emitTok
byte-for-byte; assembly + SSA naming is the renderer (validated by
iree-compile + the GPU run). lr = 0.1/B.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@cifar_bn_fwd rendered from the verified BN-CIFAR forward AST. γ/β are
scalar tensor<f32> inputs (%g{i}/%bt{i}); epsStr the ε literal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@cifar8_fwd rendered from the verified 8-conv CIFAR forward AST cifar8FwdGraph
(cifar8FwdGraph_faithful proves it denotes cifarCnn8Forward). The 4-stage peer of
cifarFwdModuleV — closes the cifar8 _fwd bytes (committed verified_mlir/cifar8_fwd.mlir
is now renderModule(provenGraph), replacing the hand-written cifar8FwdText).
Equations
- One or more equations did not get rendered due to their size.
Instances For
@cifar8_bn_fwd rendered from the verified 8-conv per-channel-BN CIFAR forward AST
cifar8BnFwdGraph (cifar8BnFwdGraph_faithful proves it denotes cifarCnnBn8Forward).
The BN peer of cifar8FwdModuleV — closes the cifar8-bn _fwd bytes, replacing the
hand-written cifar8BnFwdTextPC.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Full BN-CIFAR SGD train step (@cifar_bn_train_step). The Chapter-4
BatchNorm peer of cifarTrainStepText: each conv→relu block becomes
conv→BN→relu. The per-example BN forward (bnFwd = renderLN: reduce μ/var
over the feature axis, normalize, scalar-affine — denotes bnForward), its
consolidated three-term input-VJP (bnBack = renderLNBack — the proven
bn_grad_input, bnBack_faithful), and the scalar param grads
dγ = Σ dy·x̂, dβ = Σ dy are inserted. BN runs on the flattened
[B, oc·H·W] per-example feature vec (reshape around the 4-D conv). 22
params (4×{W,b,γ,β} + 3×{W,b}). The whole-net backward is
cifarCnnBn_has_vjp_at. lr = 0.1/B.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Per-channel BN-CIFAR eval forward (@cifar_bn_fwd): the forward half of
cifarBnTrainStepText (conv→per-channel-BN→relu ×4, 2 pools, 3 dense), returning
logits [B,nClasses]. Per-channel BN (m=H·W) is per-example ⇒ train=eval (no
running stats). String-rendered (peer of the train-step) until the typed
cifarBnFwdGraph is reconciled to per-channel in the proof pass.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Deeper 8-conv CIFAR CNN (FOUR conv→conv→pool stages) train-step + fwd text #
The 4-stage peers of cifarTrainStepText / cifarBnTrainStepText and their forwards.
Channels c1 c2 c3 c4; spatial H → H/2 → H/4 → H/8 → H/16 (CIFAR 32→16→8→4→2). The
forward is (conv→[BN→]relu)×2 → pool four times → flatten c4·Hp·Wp → 3-dense head; the
backward is the exact transpose/reverse mirror (the same op templates as the 2-stage text).
The whole-net VJPs are Proofs.cifarCnn8_has_vjp_at / cifarCnnBn8_has_vjp_at. lr = 0.1/B.
8-conv CIFAR train step (@cifar8_train_step, no BN). 4 conv→conv→pool stages
(channels ic→c1→c1, c1→c2→c2, c2→c3→c3, c3→c4→c4) + 3-dense head.
Equations
- One or more equations did not get rendered due to their size.
Instances For
8-conv CIFAR eval forward (@cifar8_fwd, no BN), returning logits [B,nClasses].
Equations
- One or more equations did not get rendered due to their size.
Instances For
8-conv CIFAR per-channel BN train step (@cifar8_bn_train_step). Each of the 8
convs is followed by bnFwd (per-channel BN, reduce spatial axis [2]); the backward
inserts the relu-mask → BN input-VJP (bnBack) → conv-back per block + BN param grads
(dγ=Σ dy·x̂, dβ=Σ dy). 38 params (8×{W,b,γ,β} + 3×{W,b}). Whole-net VJP:
Proofs.cifarCnnBn8_has_vjp_at. lr = 0.1/B.
Equations
- One or more equations did not get rendered due to their size.
Instances For
8-conv CIFAR per-channel BN eval forward (@cifar8_bn_fwd), returning logits.
Equations
- One or more equations did not get rendered due to their size.