This repository provides a curated collection of self-contained Python code examples that demonstrate the core capabilities of the PyTorch deep learning framework. The examples cover automatic differentiation, dynamic computational graphs, GPU‑accelerated tensor operations, and training of neural network models using gradient‑based optimization.
The code samples illustrate PyTorch’s dynamic graph construction, where models can change structure with native control flow, and its automatic gradient computation through reverse‑mode differentiation. Additional examples show how to work with tensors on both CPU and GPU, define custom neural network layers using the module system, and apply optimizers such as SGD, Adam, and RMSProp. The collection also includes tutorials on building computational graphs and training loops, making it a practical reference for learning PyTorch’s essential features.