探讨np.einsum的性能
原文英文,约1100词,阅读约需4分钟。发表于: 。A reader of my last blog post pointed out to me that for slicewise matmul-like operations, np.einsum is considerably slower than np.matmul unless you turn on the optimize flag in the parameters...
在未开启优化标志时,np.einsum的速度明显慢于np.matmul,尤其在矩阵乘法中。开启优化后,np.einsum的速度显著提升,接近np.matmul,原因是优化时调用了tensordot,利用了BLAS加速。