0
点赞
收藏
分享

微信扫一扫

深度学习实战之pytorch介绍与安装

素的盐 2022-11-01 阅读 89


pytorch

CPU版本安装:pip install torch==1.3.0+cpu torchvision==0.4.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

GPU版本安装:pip install torch===1.3.0 torchvision===0.4.1 -f https://download.pytorch.org/whl/torch_stable (默认是CUDA10版本)

  • 查看版本与显卡型号
  • 创建随机矩阵

x = torch.empty(5, 3)
# 符合高斯分布的随机
x = torch.rand(5, 3)
# 全0 矩阵
x = torch.zeros(5, 3, dtype=torch.long)
# 创建张量
x = torch.tensor([5.5, 3])

  • 加法操作
    -



举报

相关推荐

0 条评论