I have two 3D numpy ndarray
A=np.array([[[1, 1], [1, 1], [1, 1]], [[2, 2], [2, 2], [2, 2]]]) B=
ABijk=∑m (Aijm*Bimk) translates to
ABijk=∑m (Aijm*Bimk)
AB = np.einsum('ijm,imk->ijk', A, B)
I think the matmul operator will also handle this
matmul
AB = A @ B
since it takes the normal dot on the the last 2 dimensions, carrying the rest along as free baggage.
dot
Test those and let me know if they work.