PyTorch
PyTorch is an open-source deep learning framework developed by Facebook AI Research and widely used in both academic research and industry.
Installation
Automatic installation
Choose the right command from the official website: https://pytorch.org/get-started/locally/
Manual GPU installation
Download page: https://download.pytorch.org/whl/torch/
You need to download three packages, making sure the Python and CUDA versions match:
torch-2.4.1+cu124-cp312-cp312-win_amd64.whl
torchvision-0.19.1+cu124-cp312-cp312-win_amd64.whl
torchaudio-2.4.1+cu124-cp312-cp312-win_amd64.whl
Verify the installation
Basic concepts
Tensors
Automatic differentiation
Building neural networks
Simple model
Convolutional neural network
Training a model
Data loading
Dataset and DataLoader
Image augmentation
Saving and loading models
Jupyter Notebook setup
Create a dedicated PyTorch kernel:
Reference: https://blog.csdn.net/ccaoshangfei/article/details/126521809
Useful tips
Set the random seed
Show model structure
Freeze part of the model
Learning resources
Last modified on April 17, 2026