### numpy
# 矩阵乘法
R = np.dot(A, B)
R = np.matmul(A, B)
# 对应元素相乘
R = A * B
R = np.multiply(A, B)
### pytorch
# 矩阵乘法
R = torch.mm(A, B)
R = torch.matmul(A, B)
# 对应相乘
R = A * B
R = torch.mul(A, B)
# 带batch的乘法
# A.size() = (batch.size, n, m)
# B.size() = (batch.size, m, d)
# R.size() = (batch.size, n, d)
R = torch.bmm(A, B)
### tensorflow
# 对应相乘
R = A * B
# 矩阵相乘
R = tf.matmul(A , B)
最后
以上就是风趣热狗最近收集整理的关于numpy, pytorch, tensorflow 乘法符号及作用的全部内容,更多相关numpy,内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复