Tensor Fiber Aggregation #
The internal Rep.push, Rep.reduce, and Rep.reduceNonempty operations aggregate every
source coordinate mapping to one output coordinate. Their laws are stated for
arbitrary finite coordinate maps, not only maps parsed from einops patterns.
Transport a dependent aggregate across equality of its nonempty inputs.
Aggregate a tensor along the fibers of a coordinate map.
The output at j is the sum of all input values whose coordinates map to
j. Empty fibers contribute the additive identity.
Instances For
Reduce every finite coordinate fiber with an order-independent multiset function.
The input and output scalar types may differ. Total reducers specify a value
for the empty multiset; partial mathematical operations can instead return an
Option or use a separately proved nonempty-fiber precondition.
Instances For
Reduce fibers with an operation that is defined only on nonempty multisets.
The geometric premise is independent of tensor values. It is satisfied by a checked einops reduction exactly when the product of its removed-axis lengths is positive.
Instances For
Reduction commutes with reindexing its input coordinate space.
The coordinate equivalence merely renames elements of each fiber, so the multiset seen by the reducer is unchanged.
Reindexing reduction outputs is equivalent to transporting the target of the fiber map.
Nonempty reduction commutes with input reindexing. The two geometric nonemptiness proofs may be constructed independently; proof irrelevance makes their choice immaterial.
Output reindexing transports a nonempty reduction's target coordinates.
Pushing along the identity coordinate map does nothing.
Successive fiber aggregations compose to aggregation along the composite coordinate map.
The proof identifies an element of a composite fiber with an intermediate coordinate in the outer fiber together with an input coordinate in the corresponding inner fiber. Commutativity is what makes the order of these two finite sums immaterial.
Reindexing by a coordinate equivalence preserves the total sum of tensor entries. This is the aggregate form of the fact that an equivalence neither drops nor duplicates coordinates.