Hi, now, I have two matrics A and B, suppose A is a matrix with size(10, 3, 4,5), and 10 is batch size. B is a matrix with size(10, 5,6,7), and 10 is batch size. how can I multiply the two matrics with batch multiply and get the result matrix with size (10, 3,4,6,7)? I tried iterate over the batchsize and use torch.mm, but failed. Is there any good solution?

my codes like this:

for i in range(A.size(0)):

torch.mm(A[i,:], B[i,:]);

but failed, because the function only supports two-dimensional matrices multiplication.

Is there any good solution?