Tensor shapes
ℝ with a superscript of sizes joined by × declares an array’s shape: ℝ^{B×T×d} is a 3-axis tensor.
In ML papers
says is an array of real numbers with shape : rows and columns. Each separates one axis from the next, so is a three-axis tensor: batch size , sequence length , model width .
Common letters: batch, or or sequence length, or width, heads, per-head key size, vocabulary. Writing the shape of each term next to a formula is the fastest way to check it: in a product the inner sizes must match, and the outer ones give the result.
How to type it
| LaTeX | Shows |
|---|---|
\mathbb{R}^{n \times d} | |
\mathbb{R}^{B \times T \times d} |
A worked example
With tokens and , the attention scores form a grid, one per query-key pair.
Common confusions
- The superscript is a list of sizes, not a power: is the set of arrays. They hold 12 numbers, like vectors in , but on two axes.
- Papers differ on whether vectors are rows or columns; alone does not say which.