1. 首页
  2. 数据库
  3. 其它
  4. 关于pytorch中部分矩阵乘法的总结(torch.mmtorch.multorch.matmul)

关于pytorch中部分矩阵乘法的总结(torch.mmtorch.multorch.matmul)

上传者: 2020-12-23 01:06:59上传 PDF文件 37.91KB 热度 23次
一、torch.mul 该乘法可简单理解为矩阵各位相乘,一个常见的例子为向量点乘,源码定义为torch.mul(input,other,out=None)。其中other可以为一个数也可以为一个张量,other为数即张量的数乘。 该函数可触发广播机制(broadcast)。 tensor1 = 2*torch.ones(1,4) tensor2 = 3*torch.ones(4,1) print(torch.mul(tensor1, tensor2)) #输出结果为: tensor([[6., 6., 6., 6.], [6., 6., 6., 6.], [6.
下载地址
用户评论