Multi-head attention runs several attention functions in parallel, each on a smaller slice of the features. Splitting the vectors into heads is the first step, and it costs no extra parameters.
Implement split_heads(x, h), which turns a (T, d) sequence into (h, T, d // h).
d must be divisible by h.Reshape to (T, h, d // h), then transpose so the head axis comes first.
No results yet
Run your code to check it against the examples, or submit to run every test.