gen = np.random.RandomState(0)
ni, nj, nk = 10, 20, 100
U = gen.randn(ni, nj, nk)
V = gen.randn(nj, nk)
res1 = np.zeros((ni, nk))
for k in range(nk):
    res1[:, (k)] = U[:, :, (k)].dot(V[:, (k)])
res2 = np.einsum('ijk,jk->ik', U, V)
print(np.allclose(res1, res2))
Умножение тензора с помощью numpy tensordot