Geometry first, indices second
The fastest way to forget what a tensor 'is' is to read its definition as 'an N-dimensional array.' That's the storage view. The intuition that helps you debug a model is geometric:
- Vector (1-D) → an arrow with length (norm) and direction (feature mix). A 1024-D embedding is a single arrow in 1024-dimensional space. 'Similar concepts' = arrows pointing the same way.
- Matrix (2-D) → a stack of those arrows. Rows or columns, depending on layout. The choice between row-major and column-major is exactly which axis is contiguous in memory.
- Tensor (3-D+) → 'a matrix per time-step, per batch, per attention head.' Compute-wise it's still batches of matrices going through GEMM; the extra dims are bookkeeping.
This matters because every shape mismatch you ever debug is a question about which axis is which. 'Why is my attention output (32, 16, 64, 512) not (32, 512, 16, 64)?' is solved by holding the geometric picture: batch × heads × seq × head_dim, and remembering that the GEMM happened along the last two axes.