Reduction and shape tape nodes #
Scalar sums, broadcast-to, reduce-sum, reduce-mean, concatenation, and the linear shape adapters used by larger graph proofs.
Continuous linear map embedding a scalar into the 1D scalar-vector representation.
Instances For
The one coordinate of a scalar vector is the scalar.
Same through the WithLp wrapper.
Sum all entries of a context tensor into a scalar tensor.
Instances For
NodeFDerivCorrect for sum: derivative is the composite of context projection and coordinate
sum.
Instances For
Compute the source index in s₁ that corresponds to a target index in s₂ under broadcasting.
The recursion is on the shapes. The broadcast relation only rules out the impossible cases and shows that a source extent differing from the target extent is one.
Instances For
Broadcast a vector Vec (size s₁) into Vec (size s₂) using the CanBroadcastTo index map.
Instances For
Continuous-linear-map form of broadcastToVec.
Instances For
The bundled broadcast map computes broadcastToVec. Broadcasting is linear, so nothing about
the
shape relation cb needs to reappear in the derivative.
Source index obtained by deleting coordinate axis from an index into s.
Instances For
Repeat a flattened reduced tensor along the axis removed by shapeAfterSum.
Instances For
Continuous-linear-map form of afterSumVec.
Instances For
The bundled repeat-along-the-summed-axis map computes afterSumVec.
This map is the adjoint of summation over axis, which is why the backward pass for a reduction is
a
broadcast: each output coordinate contributed to exactly one sum.
General shape broadcast node s₁ → s₂ (linear).
Instances For
NodeFDerivCorrect for broadcastTo (broadcasting is linear).
Instances For
Sum reduction along axis (linear; adjoint is broadcast back).
Instances For
NodeFDerivCorrect for reduceSum.
Instances For
Mean reduction along axis (linear; adjoint is broadcast+scale).
Instances For
NodeFDerivCorrect for reduceMean.
Instances For
Concatenate two tensors along dimension 0 (dim-0 concat), using flattened vectors internally.
Instances For
NodeFDerivCorrect for concatLeadingAxis (concat is linear).