Entrywise formulas for row-normalization tensors #
The normalization specs are written with reduceMean, reduceVar, broadcastAfterSum,
broadcastTo, and pointwise tensor arithmetic on [m, n] matrices. This file records what each
of those operations does to a single entry get2 t i j, and how tensorToVec indexes a matrix,
so that the LayerNorm and BatchNorm proofs can work with plain real sums.
Matrix vectorization #
tensorToVec of a matrix at the flattened index (i, j) is the matrix entry.
Every flattened matrix index is idxMN of its row and column.
Two flattened matrices agree once they agree at every idxMN i j.
Vector and matrix entries of pointwise operations #
Entries of a filled vector.
Entries of a filled matrix.
Entries of a row broadcast: every column of row i reads the vector entry i.
Entries of a column broadcast: every row reads the vector entry j.
Row sums along the last axis.
Row means along the last axis.
Scalar entry of a pointwise binary operation on rank-zero tensors.
Population variance of a vector, as the scalar entry of reduceVar 0.
Row variances along the last axis (population variance of each row).
Vectors #
tensorToVec of a rank-one tensor reads the corresponding scalar entry.
Pointwise operations on matrices and vectors #
Row statistics of a spec matrix #
Mean of row i.
Instances For
Population variance of row i.
Instances For
Spec.layerNorm entrywise #
The feature axis of an [m, n] matrix is nonempty when 0 < n.
Column-broadcast evidence used by Spec.layerNorm for gamma and beta.
Row means of the LayerNorm input.
Instances For
Centered LayerNorm input.
Instances For
Clamped LayerNorm standard deviation sqrt (max (max var 0 + ε) 0).
Instances For
Spec.layerNorm with its axis and broadcast evidence spelled out.
Instances For
Spec.layerNorm is layerNormMat by unfolding.
Entries of the LayerNorm row means.
Entries of the centered LayerNorm input.
Entries of the LayerNorm standard deviation: the clamp on the variance is inactive.
Entries of layerNormMat.
Entries of Spec.layerNorm: each row is centered, divided by the clamped standard deviation
of that row, then scaled and shifted by the per-column parameters.