1. 程式人生 > 實用技巧 >陣列與切片

陣列與切片

為了方便學習深度學習,我在電腦上嘗試安裝了pytorch1.2版本,在安裝時也出現了很多錯誤,希望這期分享能幫助到深度學習的初學者們。  

環境內容

torch:1.2.0
torchvision:0.4.0

下載安裝

Anaconda,官網地址:https://www.anaconda.com/distribution/

cuda10.0,官網的地址是:
cuda10.0官網地址
cudnn7.4.1.5。,官網的地址是:
cudnn官網地址

安裝完後在C盤這個位置可以找到根目錄。
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
然後大家把Cudnn的內容進行解壓。

解壓放入C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0

配置環境變數

Win+R啟動cmd,在命令提示符內輸入以下命令建立環境:

conda create –n pytorch python=3.6

啟用環境:

activate pytorch

開啟pytorch的官方安裝方法:
https://pytorch.org/get-started/previous-versions/
官網推薦的安裝程式碼如下,我使用的是Cuda10的版本:

# CUDA 10.0
pip install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

# CUDA 9.2 pip install torch==1.2.0+cu92 torchvision==0.4.0+cu92 -f https://download.pytorch.org/whl/torch_stable.html # CPU only pip install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

測試