更新时间:2021-08-21 03:05:01
可能的解决方案是:
C = np.sum(A[:,:,:,np.newaxis]*B[:,np.newaxis,:,:],axis=2)
但是:
顺便说一句,请注意:
C = np.dot(A, B)[:, :, 0, :]
没有给出正确的结果.之所以被骗,是因为我首先通过将结果与此np.dot命令给出的结果进行比较来检查我的方法.
does not give the correct result. It got me tricked because I first checked my method by comparing the results to those given by this np.dot command.