Ho my bad I miscounted the dimensions.
What the unsqueeze does is to make the sizes 2, 1, 8, 3, 3 and 2, 4, 1, 3, 3. So that matmul can broadcast on these two dimensions of size 1 and do the matrix product you want.