Embeddings
You will learn
How a token becomes a row of numbers, and why learning changes only the rows that were read.
A network cannot multiply a word, so each token is an index into a table with one row of numbers per token, and looking a token up copies its row. In the spec the table has 4 tokens of width 2 and row v holds (10 v, 10 v + 1), so token 2 reads (20, 21). Learning sends the gradient back only to the rows that were read, and a token read twice collects both: gradient rows (1, 2) and (3, 4) on token 2 add up to (4, 6). The spec embedding_layer.t27 computes the lookup and the gradient.