Reading intermediate values out of an evaluated tape graph #
Graph.evalVec returns the whole flattened context, inputs followed by every saved intermediate.
The pointwise normalization proofs need to know what a specific block of that vector is: the
variance block of the LayerNorm prefix, for instance, must be shown nonnegative before sqrt and
inv can be differentiated.
This file gives the coordinate description of CtxVec.get and the three rules that let a proof
walk back through a snoc chain:
Graph.get_evalVec_snoc_last: the block just appended is the node's forward value;Graph.get_evalVec_snoc_of_lt: any earlier block is unchanged by appending a node;Graph.get_evalVec_input: an input block is unchanged by the whole graph.
Two typed indices with the same position are equal.
Offset of the block at list position k inside the flattened context vector.
Instances For
Every coordinate of a block lies inside the flattened context.
Every coordinate of the block selected by a typed index lies inside the context.
Coordinate description of CtxVec.get.
The block right after a prefix Γ starts at ctxSize Γ.
Appending shapes does not move the blocks of the prefix.
The first block of a flattened tensor pack is the first tensor.
Later blocks of a flattened tensor pack are blocks of the tail.
Coordinates of castCtxVec are coordinates of the original vector.
Evaluating the empty graph leaves every block in place.
The block appended by snoc is the node's forward value on the prefix evaluation.
Input blocks are unchanged by evaluating any graph.
Input blocks are unchanged by evaluating any graph, for any index into the input prefix.