How to determine a numpy-array reshape strategy,"np.einsum('ijk,kj->i', A, B)"