a = np.random.rand(3, 5, 4)
b = np.random.rand(6, 5)
out_ein = np.einsum('ijk,lj->ilk', a, b)
out_dot = np.transpose(np.dot(np.transpose(a, (0, 2, 1)), np.transpose(b, (
    1, 0))), (0, 2, 1))
np.allclose(out_ein, out_dot)
Convert einsum computation to dot product to be used in Theano