The verified trainers' packed-parameter layouts #
One namespace per net family (MlpLayout, CnnLayout, CifarLayout, ResNet34Layout,
MobileNetV2Layout, EfficientNetLayout, ConvNeXtLayout, ViTLayout): each net's
(dims, initKind) list in the train step's argument order, its sizes, and the packed shape
descriptors (packShapes, packXShape) the runtime passes to the FFI. Pure data — importing only LEBytes —
so the spec side (VerifiedNetsCore's #guard spec.toSpecs == XLayout.specs) can read the tables
without importing the runtime; IreeRuntime re-exports them.
Equations
Instances For
Pack a single shape: [rank, d0, d1, ...] as int32 LE (for x input).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- CnnLayout.xShape batch = packXShape #[batch, 784]
Instances For
Instances For
Equations
- CifarLayout.xShape batch = packXShape #[batch, 3072]
Instances For
Equations
- ResNet34Layout.paramShapes = Array.map (fun (x : Array Nat × Nat) => x.fst) ResNet34Layout.specs
Instances For
Equations
- ResNet34Layout.nParams = Array.foldl (fun (x1 x2 : Nat) => x1 + x2) 0 (Array.map (fun (s : Array Nat × Nat) => Array.foldl (fun (x1 x2 : Nat) => x1 * x2) 1 s.fst) ResNet34Layout.specs)
Instances For
Instances For
Equations
- ResNet34Layout.xShape batch = packXShape #[batch, 3 * 224 * 224]
Instances For
Equations
- MobileNetV2Layout.paramShapes = Array.map (fun (x : Array Nat × Nat) => x.fst) MobileNetV2Layout.specs
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- MobileNetV2Layout.xShape batch = packXShape #[batch, 3 * 224 * 224]
Instances For
(dims, initKind) for every param, in func-arg order — generated from the B0 stage
spec exactly as tests/TestEfficientNet*.lean blocks (stem out 32, prev threading).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- EfficientNetLayout.paramShapes = Array.map (fun (x : Array Nat × Nat) => x.fst) EfficientNetLayout.specs
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Instances For
Equations
- EfficientNetLayout.xShape batch = packXShape #[batch, 3 * 224 * 224]
Instances For
(dims, initKind) for every param, in func-arg order.
⚠ §2m moved three things at once: every LN affine went rank-0 #[] → per-channel #[c],
the stem LN appeared, and the head LN went away. The first two were right; the third
was not, and the note that used to sit here — "the last two nearly cancel … so a matching
parameter count is a decomposition test, not an architecture check" — was the correct
warning drawn at the wrong conclusion. The residue is not noise, it IS the missing layer:
28,587,592 against timm.create_model('convnext_tiny')'s 28,589,128 is short by exactly
2×768 = 1,536.
⭐ The head LN is back (2026-08-30, §7.1), so the head is GAP → LN(768) → dense as in
both the paper (self.norm(x.mean([-2,-1])), nn.LayerNorm(dims[-1], eps=1e-6)) and timm
(NormMlpClassifierHead). 182 param tensors; the floats are 27,827,818 at K = 10,
i.e. 28,589,128 at K = 1000 — timm's count exactly.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- ConvNeXtLayout.paramShapes = Array.map (fun (x : Array Nat × Nat) => x.fst) ConvNeXtLayout.specs
Instances For
Equations
- ConvNeXtLayout.nParams = Array.foldl (fun (x1 x2 : Nat) => x1 + x2) 0 (Array.map (fun (s : Array Nat × Nat) => Array.foldl (fun (x1 x2 : Nat) => x1 * x2) 1 s.fst) ConvNeXtLayout.specs)
Instances For
Instances For
Equations
- ConvNeXtLayout.xShape batch = packXShape #[batch, 3 * 224 * 224]
Instances For
Equations
- ViTLayout.paramShapes = Array.map (fun (x : Array Nat × Nat) => x.fst) ViTLayout.specs
Instances For
Equations
- ViTLayout.nParams = Array.foldl (fun (x1 x2 : Nat) => x1 + x2) 0 (Array.map (fun (s : Array Nat × Nat) => Array.foldl (fun (x1 x2 : Nat) => x1 * x2) 1 s.fst) ViTLayout.specs)
Instances For
Instances For
Equations
- ViTLayout.xShape batch = packXShape #[batch, 3 * 224 * 224]