在conda 虛擬環(huán)境下安裝torch==1.7.1+GPU版本
本機環(huán)境
- CUDA 11.0
- Python 3.7
安裝torch1.7.1
官網(wǎng)搜索確認需要下載的對應(yīng)本機cuda的torch版本,使用在線下載即可,會直接安裝好torch、torhvision、torchaudio。
1、官網(wǎng)搜索對應(yīng)cuda的版本
2、安裝命令文章來源:http://www.zghlxwxcb.cn/news/detail-527299.html
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=11.0 -c pytorch
查看安裝版本
import torch
# 檢測torch、cuda、cudnn版本
print(torch.__version__)
print(torch.version.cuda)
print(torch.backends.cudnn.version())
# 是否可用gpu
flag = torch.cuda.is_available()
print(flag)
文章來源地址http://www.zghlxwxcb.cn/news/detail-527299.html
到了這里,關(guān)于【pytorch】torch1.7.1安裝、查看torch版本、GPU是否可用的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!