§B shared prerequisite: the DEPTHWISE adjoint gate + leaf ties #
The §B certified-VJP ties for the three CNNs (convnext / mnv2 / efficientnet) all reverse a
depthwise convolution, so they all need the depthwise twin of the conv adjoint gate
IR.convBackDenote_eq_input_grad_formula. This file builds it once.
depthwiseConv2d_dwReverse_eq_input_grad_formula— the gate: the emitted reversed-kernel forward depthwise convdepthwiseConv2d (dwReverse W) 0equals the certified depthwise input-gradientdepthwiseConv2d_input_grad_formula W, for arbitrary dims with odd kernels. The exact depthwise analogue of the conv gate — same(kh,kw) ↦ (kh+hi-pH, kw+wi-pW)partial bijection on the pad supports, MINUS theΣ cochannel sum (depthwise has no cross-channel mixing, so the input channel reads only from its own kernel/gradient channelch).depthwiseFlatBack_eq_vjp_backward— the stride-1 leaf tie: the backward mapdepthwiseFlatBack W(=depthwiseFlat (dwReverse W) 0) IS the certified depthwise input-VJP(depthwiseFlat_has_vjp W b).backward x(depthwise conv is linear ⇒ the saved activationxis ignored). The depthwise peer ofconvFlatBack_eq_vjp_backward.depthwiseStride2FlatBack_eq_vjp_backward— the strided leaf tie:depthwiseStride2FlatBack W(=depthwiseFlatBack ∘ decimateBack) IS(depthwiseStride2Flat_has_vjp W b).backward x. The depthwise peer offlatConvStride2Back_eq_vjp_backward(conv leaf + thedecimateBackrfl).
The depthwise conv-adjoint identity (odd kernels), all dims. The emitted reversed-kernel
forward depthwise conv depthwiseConv2d (dwReverse W) 0 equals the certified depthwise
input-gradient depthwiseConv2d_input_grad_formula W, for arbitrary c h w kH kW with odd
kernels. The depthwise twin of IR.convBackDenote_eq_input_grad_formula: per output coordinate
both sides sum over the SAME valid alignments via (kh,kw) ↦ (kh+hi-pH, kw+wi-pW); under oddness
2·pH = kH-1 the reversed-kernel index kH-1-kh matches the formula's hi+pH-ho. No Σ co
(depthwise channel ch is fixed). Finset.sum_bij' over the pad-filtered supports; all index
arithmetic by omega. The load-bearing leaf for the depthwise §B ties (convnext/mnv2/enet).
Depthwise conv input-VJP leaf tie. The backward map depthwiseFlatBack W (= reversed-kernel
forward depthwise conv) IS the certified depthwise input-VJP (depthwiseFlat_has_vjp W b).backward x (depthwise conv is linear, so the saved activation x is ignored), for odd kernels. Routes
through depthwiseConv2d_dwReverse_eq_input_grad_formula; the depthwise peer of
convFlatBack_eq_vjp_backward.
Strided depthwise conv input-VJP leaf tie. depthwiseStride2FlatBack W (= depthwiseFlatBack ∘ decimateBack) IS the certified strided depthwise input-VJP (depthwiseStride2Flat_has_vjp W b).backward x, for odd kernels. Decomposes into the stride-1 depthwise leaf tie
(depthwiseFlatBack_eq_vjp_backward) and the decimate leaf (decimateBack_eq_vjp, rfl),
matching depthwiseStride2Flat = decimateFlat ∘ depthwiseFlat. The depthwise peer of
flatConvStride2Back_eq_vjp_backward; unlocks the mnv2 stride-2 inverted-residual downsample.
XLA-SAME strided depthwise input-VJP leaf tie. depthwiseStride2FlatXlaBack W
(= depthwiseFlatBack ∘ decimateOddBack) IS the certified
(depthwiseStride2FlatXla_has_vjp W b).backward x, for odd kernels. The odd-phase peer of
depthwiseStride2FlatBack_eq_vjp_backward; MobileNetV2's four strided depthwises and B0's
downsample depthwise, at the TF-origin convention.