想必大家查看自己cuda是11.2版本,但是在pytorch官网没有找到对应的安装命令,请参考一下命令:文章来源:https://www.toymoban.com/news/detail-521862.html
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.2 -c pytorch -c conda-forge
测试:文章来源地址https://www.toymoban.com/news/detail-521862.html
import torch
torch.cuda.is_available() # cuda是否可用
torch.cuda.current_device() # 返回当前设备索引
torch.cuda.device_count() # 返回GPU的数量
torch.cuda.get_device_name(0) # 返回gpu名字,设备索引默认从0开始
到了这里,关于cuda11.2对应pytorch安装的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!