ℝ→Float32 bridge: depthwise convolution (the one new conv lemma for EfficientNet) #
EfficientNet's MBConv depthwise stage is the only forward op in the enet line whose
float bound isn't already a wrap of an existing closeness. Structurally it is easier
than a full conv: per output (ch, hi, wi) it is
depthwiseConv2d W b x ch hi wi = b ch + Σ_{kh,kw} W ch kh kw · pad(x ch …)
— a dot over the kH·kW window with no channel sum (fan-in kH·kW, not ic·kH·kW).
That is the depthwise efficiency advantage, and it carries to the bound: the Higham
γ-factor rides kH·kW.
We get it for free from the existing conv scaffolding. The padded read in the depthwise
forward is definitionally convPad kH kW x ch kh kw hi wi (same SAME-padding dite),
so each output channel is a single-output Proofs.dense over the kH·kW-flattened
window (depthwiseConv2d_eq_dense), and dense_close / denseErr_le_uniform deliver
the budget exactly as they do for the regular conv (flatConvF_close). Then
floatClose_depthwise is the FloatClose wrap, the depthwise peer of
floatClose_flatConv.
The per-output-coordinate depthwise window as a flat Vec over the kH·kW
fan-in: channel ch's padded reads that its filter dots against. The depthwise
analogue of convWindow, one channel only (no ic axis).
Equations
- Proofs.dwWindow kH kW x ch hi wi idx = Proofs.convPad kH kW x ch (finProdFinEquiv.symm idx).1 (finProdFinEquiv.symm idx).2 hi wi
Instances For
Channel ch's depthwise filter as a single-column Mat (kH·kW) 1.
Equations
- Proofs.dwKernelMat W ch idx x✝ = W ch (finProdFinEquiv.symm idx).1 (finProdFinEquiv.symm idx).2
Instances For
Depthwise conv2d is a single-output dense at fan-in kH·kW — each output
channel ch is Proofs.dense of its flattened filter against its window. The
structural fact that lets the float depthwise budget reuse dense_close.
Depthwise output magnitude bound = dense_abs_le at fan-in kH·kW.
The float depthwise conv — M.dense of the single-column filter against the
flattened window, per output coordinate. The float peer of depthwiseConv2d.
Equations
- M.depthwiseConv2dF W b x ch hi wi = M.dense (Proofs.dwKernelMat W ch) (fun (x : Fin 1) => b ch) (Proofs.dwWindow kH kW x ch hi wi) 0
Instances For
Depthwise conv forward rounding budget. The rounded depthwise conv at a float
input within e of the real activation is within the kH·kW-fan-in denseErr of
the real depthwise conv — dense_close at the flattened window.
Vec-space float depthwise conv — the float peer of depthwiseFlat
(flatten ∘ depthwiseConv2d ∘ unflatten), with the rounded depthwiseConv2dF.
Equations
- M.depthwiseFlatF W b v = (M.depthwiseConv2dF W b (Proofs.Tensor3.unflatten v)).flatten
Instances For
Vec-space depthwise forward budget, uniform. The rounded depthwiseFlatF at a
float input within e of the real activation is within the kH·kW-fan-in
layerBudget of the real depthwiseFlat, every output coordinate.
Vec-space depthwise magnitude bound (the activation-norm pass-through).
Depthwise convolution is FloatClose with modulus the depthwise-fan-in
layerBudget (fan-in kH·kW, no channel sum — the depthwise efficiency carries
into the budget). Real output ≤ layerAct; float output ≤ that + the fresh-input
rounding layerBudget(e=0). The depthwise peer of floatClose_flatConv; the
MBConv depthwise stage folds through .comp like any other conv.