It runs, and the shape is right. But each row now holds pieces of two positions:
Merged without the transpose back
went in (3, 4)
01231011121320212223
came back (3, 4)
01101120212312132223
Red is a number in another position's row. Row 0 came back with positions 0 and 1, row 1 with 2 and 0, row 2 with 1 and 2. No error.
This is the quiet failure. The loud one, a bare view after the transpose, at least tells you what to fix.
In the editor, write merge_heads(y). split_heads is already there, and the last line splits and merges the labeled tensor, which should come back unchanged.
Pick an answer above to see the rest
Instructions
1
Write merge_heads(y): (B, H, T, d) in, (B, T, H * d) out.
2
Transpose the heads back behind the positions, then join the last two axes with a call that copies when it has to.