import numpy as np
A = np.random.random((2, 2, 3))
B = np.random.random((2, 2, 3))
C1 = np.empty((2, 2, 3))
for i in range(3):
    C1[:, :, (i)] = np.dot(A[:, :, (i)], B[:, :, (i)])
C2 = np.einsum('ijn,jkn->ikn', A, B)
np.allclose(C1, C2)
multiplication of 3-dimensional matrix in numpy