pytorch1.7.1的安装环境配置

  • Post author:
  • Post category:其他




安装torch

 - `pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html`



安装cuda

下载cuda11.0和cudnn8.0.5.39。


参考



测试代码

import torch
flag = torch.cuda.is_available()
print(flag)

ngpu= 1
# Decide which device we want to run on
device = torch.device("cuda:0" if (torch.cuda.is_available() and ngpu > 0) else "cpu")
print(device)
print(torch.cuda.get_device_name(0))
print(torch.rand(3,3).cuda()) 



版权声明:本文为harrylee777原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。