Derivative of General Convolution #
This file proves the derivative and reverse-mode formulas for channels-first convolution at an arbitrary spatial rank. All sums use bounded multi-indices; no axis count is fixed in a theorem.
Read a channel and bounded spatial coordinate from a channels-first tensor.
Instances For
Read two leading channels followed by a bounded spatial coordinate.
Instances For
Split a channels-first tensor dot product into channel and spatial sums.
Expand a channels-first lookup into the unique bounded spatial coordinate that it names.
The scalar coefficient connecting one input coordinate to one output coordinate.
Instances For
One coordinate of the generic convolution contraction, written as finite sums.
Convolution is the matrix represented by convCoefficient at every spatial rank.
One kernel-gradient coordinate is the contraction of input and output cotangent.
One bias-gradient coordinate is the spatial sum of the output cotangent.
A bias-gradient coordinate in the ordinary rank-one tensor view.
Broadcasting a bias reads the same channel value at every spatial coordinate.
One input-gradient coordinate is the transpose-index convolution used by the runtime.
The implemented input gradient is multiplication by the transposed coefficient matrix.
Adjoint identities #
The forward input map and implemented input gradient are adjoint at every spatial rank.
The kernel contraction and implemented kernel gradient are adjoint.
Bias broadcasting and spatial reduction are adjoint.
Fréchet derivative #
Euclidean coordinates indexed by a tensor shape list.
Instances For
Build shape-indexed Euclidean coordinates from a coordinate function.
Instances For
Coordinates of coordVecOfFun f are the values of f.
Vectorize a tensor using bounded multi-indices rather than flattened natural indices.
Instances For
Coordinate i of a vectorized tensor is the tensor entry at i.
Convolution is indexed by bounded multi-indices rather than one flat Fin, because the stride and
padding arithmetic is stated per axis; keeping the vectorization multi-indexed means no flattening
appears in any of the derivative proofs.
The kernel/input contraction in Euclidean coordinates.
Instances For
Unfolds one output coordinate of the contraction into its double sum.
Tensor convolution and its Euclidean-coordinate contraction agree at every spatial rank.
Euclidean kernel coordinates for a rank-general convolution.
Instances For
Euclidean input coordinates for a rank-general convolution.
Instances For
Euclidean output coordinates for a rank-general convolution.
Instances For
The convolution contraction is additive in its input coordinates.
The convolution contraction respects scalar multiplication in its input coordinates.
The convolution contraction is additive in its kernel coordinates.
The convolution contraction respects scalar multiplication in its kernel coordinates.
Continuous bilinear form of rank-general convolution.
Instances For
The bundled bilinear map computes the same contraction as convCoreVec.
Bundling matters: once convolution is a continuous bilinear map, its derivative in each argument comes from Mathlib rather than from a hand-written difference quotient.
Continuous linear bias broadcast in Euclidean coordinates.
Instances For
Bias broadcast copies the channel entry to every spatial position of that channel.
Coordinate conversion preserves pointwise tensor addition.
Tensor bias broadcasting agrees with the corresponding coordinate map.
Coordinate form of a complete convolution layer, including bias.
Instances For
Tensor-level convSpec agrees with convForwardVec.
Euclidean state space of one rank-general convolution application.
Instances For
Product-rule derivative of a complete convolution state.
Instances For
The exact derivative of a rank-general convolution is its kernel/input product rule plus bias.
Applying the analytic derivative gives the tensor-level convolution JVP.
The implemented convolution backward pass is the adjoint of the exact JVP.
convBackwardSpec returns a ConvGradients record, so the equation below reads one inner product
per gradient, each paired with the matching piece of the input tangent. An earlier version returned
a bare triple and had to project the components out by position, which is the same proposition and
considerably harder to check against a sentence describing it.