core/nn/transformer_encoder library

Stack of TransformerBlocks with an optional final LayerNorm.

The final norm (on by default) is standard in pre-LN transformers: the residual pathway is not normalized on its way out of the last block, so a trailing LayerNorm stabilizes the representation before the head projection.