Solved by ptrblck in post #2 
              
              
                Would this code work? 
B, C, i, j, k = 2, 3, 4, 5, 6

A = torch.randn(B,C,j,i)
B = torch.randn(B,C,j,k)

C = torch.matmul(A.unsqueeze(4), B.unsqueeze(3))
print(C.shape)