Evaluating the LayerNorm graph #
Closed forms for every saved intermediate of layerNormGraph. Each val* definition is the value
the corresponding node computes from the packed input [X, gamma, beta], and each get_* lemma
identifies the block of Graph.evalVec at that stage with its closed form.
Two consequences drive the calculus: the per-row variance block is a mean of squares, so it is
nonnegative, and therefore var + ε is positive and the clamped square root is nonzero as soon as
0 < ε. Those two facts are exactly the domain hypotheses of the LayerNorm graph theorem.
Closed forms of the intermediates #
Stage evaluations #
Stage graphMeanBroadcast: the broadcast mean block.
Stage graphCentered: the centered block.
Stage graphCenteredSq: the squared centered block.
Stage graphVarEps: the shifted variance block.
Stage graphInvStd: the inverse standard deviation block.
Stage graphInvStdBroadcast: the broadcast inverse standard deviation block.
The centered block is still available at stage graphInvStdBroadcast.
Stage graphNormalized: the normalized block.
Stage graphGammaBroadcast: the broadcast scale block.
The normalized block is still available at stage graphGammaBroadcast.
Stage graphScaled: the scaled block.
Stage graphBetaBroadcast: the broadcast shift block.
The scaled block is still available at stage graphBetaBroadcast.
The output block of the full LayerNorm graph.