Hi,
The matrix multiplication is always done with using the last two dimensions. All the ones before are considered as batch.
In your case the matrix multiplications will be of size 100x10 and 10x50. The batch dimensions are 1000x500 and 500 and so will be broadcasted to 1000x500. The final output will thus be of size 1000x500x100x50.