tf.matmul矩阵乘法,叉乘。
tf.multiply和*一样都是点乘,对应位置的元素相乘。
写这篇文章的初衷是因为看神经网络的代码时,总是看到很多在乘之前有reshape的操作,比较懵逼。因为自己对超过三维的矩阵乘法就不了解了。就目前我的认知来说,之所以进行reshape是为了方便矩阵乘。
torch.mm是矩阵乘
torch.mul是点乘,*也是点乘
轻易不要用*,因为有可能会有误差。
tf.matmul矩阵乘法,叉乘。
tf.multiply和*一样都是点乘,对应位置的元素相乘。
写这篇文章的初衷是因为看神经网络的代码时,总是看到很多在乘之前有reshape的操作,比较懵逼。因为自己对超过三维的矩阵乘法就不了解了。就目前我的认知来说,之所以进行reshape是为了方便矩阵乘。
torch.mm是矩阵乘
torch.mul是点乘,*也是点乘
轻易不要用*,因为有可能会有误差。