
Learn the basics of PyTorch, including automatic differentiation, neural networks (MLP and CNN), and GPU computation, with practical examples and fundamentals like gradient descent.
Explore how automatic differentiation enables gradient descent to optimize high-dimensional functions by composing simple building blocks with chain rule, enabling fast, exact derivatives in PyTorch.
Explore automatic differentiation by constructing forward and backward passes for the exponential function, applying the chain rule to compute gradients, and comparing a two-pass framework with PyTorch.
Learn how to create and manipulate tensors in PyTorch, perform elementwise and matrix operations, reshape and concatenate, and validate results with allclose and epsilon checks.
learn to use PyTorch to compute gradients and apply gradient descent, updating x with a learning rate, zeroing gradients each step, and converting between tensors and NumPy arrays.
Learn how to create and use PyTorch optimizers such as SGD and Adam to update model parameters, set learning rates, manage momentum, and monitor convergence through gradient steps.
Explore differentiable ballistic simulation with a PyTorch gradient-descent loop to adjust initial conditions and hit a target, using a custom simulator and loss optimization.
PyTorch schedulers automatically adjust the learning rate to speed up loss convergence, using a multi-step schedule with milestones at epochs 25 and 50 and gamma 0.5.
Learn to build and train a PyTorch multilayer perceptron for image classification, using linear layers, activation, softmax, and cross-entropy loss on MNIST with mini-batch training.
Demonstrate training PyTorch on Google Colab GPUs, setting the device to cuda, moving data and models to GPU, and achieving about 95% accuracy with a CNN on digits.
Design a CNN in PyTorch from two conv blocks, replacing an MLP, converting images to features and using fc layers for a 10-class classifier, achieving 98% accuracy.
Share constructive comments to help improve this PyTorch crash course and guide future machine learning sessions with bonus sessions inspired by your feedback.
In this course, I will explain in a practical and intuitive way how PyTorch works. We will go beyond the use of the API which will allow you to continue your journey in machine learning and/or differentiable programming with more confidence.
This course is divided into three parts.
In the first part, we will implement (in Python, from scratch) our own differentiable programming framework, which will be very similar to PyTorch. This will allow you to understand how PyTorch, TensorFlow, JAX, etc. work. Then, we will focus on PyTorch and see the basic tensor operations, the calculation of gradients and the use of graphics cards (GPUs).
In the second part, we will focus on gradient descent algorithms (essential for training neural networks). We will implement the simulator of a ballistic problem and see how to use the power of PyTorch to solve an optimization problem (this pedagogical problem can be easily extended to real problems, such as fluid mechanics simulations, for those who wish). We will also see how to use optimizers and how to combine them with schedulers to make them even more efficient.
Finally, we will tackle neural networks. We will solve an image classification problem, first with an MLP, and then with a CNN.
If this program enchants you, don't wait any longer!