Conv2D Backward Approximation #
NF (rounded) backend: Conv2D backward (VJP) runtime→spec approximation.
This file proves soundness of explicit bounds for the three Conv2D gradients computed by
Spec.conv2d_backward_spec:
- kernel gradient
- bias gradient
- input gradient
The file is intentionally explicit because each gradient has a different nested-indexing pattern.
The important public objects are the tensor-level bounds (conv2d*BoundTensor), the approximation
theorems (approxT_conv2d_*_deriv_spec), and conv2dRevNode, which packages Conv2D as a RevNode
so it composes via RevGraph.backprop_approx.
PyTorch analogue: these are the VJP/gradient computations produced by Autograd for Conv2D. https://pytorch.org/docs/stable/autograd.html https://pytorch.org/docs/stable/generated/torch.nn.functional.conv2d.html
Map of this file #
- Shared padding/read lemmas (to relate the padded-input branches to the original
approxThypothesis). - Bias gradient bounds:
conv2dBiasPointBound,approx_conv2d_bias_point, and tensor-lifted bound. - Kernel gradient bounds:
conv2dKernelPointBound,approx_conv2d_kernel_point, and tensor-lifted bound. - Input gradient bounds:
conv2dInputPointBound,approx_conv2d_input_point, and tensor-lifted bound. conv2dRevNode: packaging as aRevNodeso the bound composes inside larger graphs.
References #
- Dumoulin & Visin, A guide to convolution arithmetic for deep learning (indexing/stride/padding conventions).
- Goodfellow, Bengio, Courville, Deep Learning (MIT Press, 2016), convolution/backprop background.
- Baydin et al., Automatic Differentiation in Machine Learning: a Survey (JMLR 2018) (VJP framing).
Pointwise error bound for the Conv2D bias gradient (NF runtime vs spec).
This bound is a replay of the bias-gradient summation with per-term error epsδ coming from the
grad_output approximation hypothesis.
Instances For
Soundness of the Conv2D bias-gradient pointwise bound.
Given approxT for grad_output, this shows the spec bias-gradient entry is approximated by the
NF runtime entry within conv2dBiasPointBound.
Tensor-shaped bias-gradient bound.
This packages conv2dBiasPointBound into a Tensor so later approxT statements can use
linfNorm to obtain a single scalar error bound.
Instances For
Pointwise error bound for the Conv2D kernel gradient (NF runtime vs spec).
The kernel-gradient entry accumulates products of padded input values and upstream gradients.
The bound is a replay of this accumulation with per-term errors derived from epsX and epsδ.
Instances For
Soundness of the Conv2D kernel-gradient pointwise bound.
Given approxT hypotheses for the input and upstream gradient (grad_output), this shows the spec
kernel-gradient entry is approximated by the NF runtime entry within conv2dKernelPointBound.
Tensor-shaped kernel-gradient bound.
This packages conv2dKernelPointBound into the full 4D kernel-tensor shape so later approxT
lemmas can use a single global bound via linfNorm.
Instances For
Tensor-level approxT bound for the Conv2D bias gradient.
This lifts approx_conv2d_bias_point entrywise and packages the error into
linfNorm (conv2dBiasBoundTensor ...).
Tensor-level approxT bound for the Conv2D kernel gradient.
This lifts approx_conv2d_kernel_point entrywise and packages the error into
linfNorm (conv2dKernelBoundTensor ...).
Pointwise error bound for the Conv2D input gradient (NF runtime vs spec).
The input-gradient entry accumulates contributions from all output channels and spatial positions
that “hit” the given input coordinate under the stride/padding relation. The bound is a replay of
that accumulation with per-term errors derived from epsK and epsδ.
Instances For
Tensor-shaped input-gradient bound.
This packages conv2dInputPointBound into the full input image shape so later approxT lemmas
can use a single global bound via linfNorm.
Instances For
Soundness of the Conv2D input-gradient pointwise bound.
Given approxT hypotheses for the kernel and upstream gradient (grad_output), this shows the spec
input-gradient entry is approximated by the NF runtime entry within conv2dInputPointBound.
Tensor-level approxT bound for the Conv2D input gradient.
This lifts approx_conv2d_input_point entrywise and packages the error into
linfNorm (conv2dInputBoundTensor ...).
Package Conv2D forward + backward (VJP) as a RevNode for RevGraph.backprop_approx.
The node uses the forward bound from conv2d_forward and the three gradient bounds proved in this
file (kernel/bias/input) to provide a compositional reverse-mode approximation theorem.