numpy 点积的爱因斯坦符号

Einstein notation for numpy dot product

如何使用爱因斯坦符号写出以下点积?

import numpy as np
LHS = np.ones((5,20,2))
RHS = np.ones((20,2))
np.sum([
    np.dot(LHS[:,:,0], RHS[:,0]),
    np.dot(LHS[:,:,1], RHS[:,1]),
], axis=0)

那就是-

np.einsum('ijk,jk->i',LHS,RHS)

或者 tensordot -

np.tensordot(LHS,RHS,axes=((1,2),(0,1)))

np.dot -

LHS.reshape(LHS.shape[0],-1).dot(RHS.ravel())