PyTorch(01)-安裝

一、環境介紹

cat /etc/*release*
openEuler release 20.03 (LTS)

uname -a
Linux 4.19.90-2003.4.0.0036.oe1.x86_64 #1 SMP Mon Mar 23 19:10:41 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

nvidia-smi NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2
GeForce MX250 0MiB / 2002MiB

python3.8 --version
Python 3.8.6

目前torch不支持python3.9

二、安裝

獲取安裝命令: https://pytorch.org/get-started/locally/#linux-pip

PyTorch Build: Stable (1.7.0)
Your OS: Linux
Package: Pip
Language: Python
CUDA: 10.2
Run this Command: pip install torch torchvision

具體命令: pip3.8 install torch torchvision

所有版本下載地址: https://download.pytorch.org/whl/torch_stable.html

三、驗證

python3.8 -c "import torch;x = torch.rand(5, 3);print(x)"

tensor([[0.4857, 0.5264, 0.5910], [0.9196, 0.8787, 0.5331], [0.1681, 0.0487, 0.2963], [0.3761, 0.2133, 0.2272], [0.0082, 0.3242, 0.3002]])

python3.8 -c "import torch;print(torch.cuda.is_available())"

True

四、教程

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章