1. 首页
  2. 数据库
  3. 其它
  4. Pytorch的加法细节操作提高运算速度

Pytorch的加法细节操作提高运算速度

上传者: 2020-12-31 19:49:51上传 PDF文件 66.34KB 热度 15次
Pytorch 加法操作: 1. + 这个是最直接的加法。 res = x + y 2. torch.add() pytorch 官网提供的一种加法函数。 res = torch.add(x, y) # 也可以指定加法结果输出对象 torch.add(x, y, out=result) 3. .add_() 这个是Tensor类的方法。 res = y.add_(x) 加法速度比较: 这么多的加法操作,哪个更稳定速度更快? 实例: import torch import time x = torch.rand(5, 3) y = torch.rand(5, 3) start = time
下载地址
用户评论