This tutorical contains content abouts how to set up Pytorch environment in a PC with CUDA.
Three parts are included in this turtorial when installing Pytorch.
Reference: https://pytorch.org/get-started/locally/
Part 1: Install Python using Anaconda
Anaconda : Downloaded from https://www.anaconda.com/products/individual#windowsand follow the instruction.
Click on the installer link and select Run
. Anaconda will download and the installer prompt will be presented to you. The default options are generally sane.
Part 2: Install Pytorch
Use anaconda prompt to install.
Open https://developer.nvidia.com/zh-cn/cuda-zone choose OS: Windows, Package: Conda and the CUDA version suited to your machine. Then, run the command that is presented to you.
Part 2: Verification
Open command line and input the following.
python
then enter the following code:
import torch
x = torch.rand(5, 3)
print(x)
The output should be something similar to:
tensor([[0.3380, 0.3845, 0.3217],
[0.8337, 0.9050, 0.2650],
[0.2979, 0.7141, 0.9069],
[0.1449, 0.1132, 0.1375],
[0.4675, 0.3947, 0.1426]])