Project token rows through a packed QKV matrix. x is T × I and weight is I × (3D); its columns contain all Q features, then all K, then all V. Return {"q": Q, "k": K, "v": V}, each of shape heads × T × (D/heads). Within each projection, consecutive features belong to consecutive heads.
def packed_qkv(x, weight, heads):
Constraints
1 ≤ T,I,D ≤ 12; heads is a positive divisor of D.
Inputs are finite; no bias is applied.
Inputs satisfy these constraints; invalid-input handling is not graded. Use only Python standard library and NumPy.