tom:

torch.einsum('bi,ij,bj', U, M, V) if you want the sum, 'bi,ij,bj->b' if you prefer the batch items separately. 
Best regards
Thomas


Perfect, thanks! Einsum is really neat, I took the time to get familiar with it and came up with the same result.