PyTorch is a Python-based tensor computing library with high-level support for neural network architectures. It also supports offloading computation to GPUs. A product of Facebook’s AI research team and open sourced a little more than a year ago, PyTorch has fast become the first choice of many deep learning practitioners.
In this tutorial, we’ll dive into the basics of running PyTorch on Linux, from installation to creating and training a simple neural network that can recognize digits. We’ll cap it off by tackling a more complicated example that uses convolutional neural networks (CNNs) to improve accuracy. This won’t be a full introduction to neural networks, but I will explain neural networking concepts as they crop up in our code.
While a computer with a GPU is not necessary for this tutorial, it is recommended. If you want to follow along in a Jupyter notebook, you can make use of the version of this article on GitHub.
The easiest way to install PyTorch is to use the Anaconda Python distribution. If you have Anaconda installed, you can get the latest PyTorch by entering this command: