Convolution Index Arithmetic #
The forward and transpose convolution loops describe the same integer relation from opposite directions. This file proves that relation once for an arbitrary list of spatial axes. The only geometric hypothesis is the standard one that every stride is positive.
Finite spatial indices #
A shape-indexed spatial coordinate, represented without partial list indexing.
Instances For
Convert a bounded spatial coordinate to the runtime list representation.
Instances For
Read a tensor at a bounded spatial coordinate.
Instances For
Reading a dim tensor peels the leading coordinate and recurses into that slice.
Reading the sole scalar coordinate below a vector index agrees with the vector view.
An index that runs out too early reads zero.
Otherwise the leading coordinate is bounds-checked and the lookup recurses, reading zero when it falls outside. This total lookup is what lets padding be expressed without a separate case split at every use site: an out-of-range index simply contributes nothing.
Split a finite sum over a nonempty multi-index into its leading coordinate and tail.
Reading a generated tensor applies the generating function to the index's coordinate list.
Bounded-coordinate lookup commutes with pointwise tensor addition.
On an in-range index the total lookup agrees with the bounded one.
This is the lemma that connects the two indexing styles in the file: implementations use unbounded
List Nat coordinates, specifications use MultiIndex, and inside the bounds they coincide.
A total lookup is the finite coordinate sum selected by equality of index lists.
This formulation handles valid indices, padding, and malformed or out-of-range lists uniformly.
The executable nested index fold is the finite sum over bounded coordinates.
Recursive tensor dot product as a finite sum over bounded multi-indices.
Every stride in a runtime list is positive.
Instances For
Solving a forward convolution index and then solving backwards recovers the output index.
Solving a transpose convolution index and then solving forwards recovers the input index.
The two index solvers define the same relation when strides are positive.