PyTorch is a Python package that provides two high-level features:
Tensor computation (like NumPy) with strong GPU acceleration
Deep neural networks built on a tape-based autograd system
You can reuse your favorite Python packages such as NumPy, SciPy, and Cython to extend PyTorch when needed.
More about PyTorch
Installation
Binaries
From Source
Docker Image
Building the Documentation
Previous Versions
Getting Started
Communication
Releases and Contributing
The Team
System 3.6 3.7 3.8
Linux CPU Build Status Build Status —
Linux GPU Build Status Build Status —
Windows CPU / GPU — Build Status —
Linux (ppc64le) CPU — Build Status —
Linux (ppc64le) GPU — Build Status —
Linux (aarch64) CPU Build Status Build Status Build Status
See also the ci.pytorch.org HUD.
More About PyTorch
At a granular level, PyTorch is a library that consists of the following components:
Component Description
torch a Tensor library like NumPy, with strong GPU support
torch.autograd a tape-based automatic differentiation library that supports all differentiable Tensor operations in torch
torch.jit a compilation stack (TorchScript) to create serializable and optimizable models from PyTorch code
torch.nn a neural networks library deeply integrated with autograd designed for maximum flexibility
torch.multiprocessing Python multiprocessing, but with magical memory sharing of torch Tensors across processes. Useful for data loading and Hogwild training
torch.utils DataLoader and other utility functions for convenience
Usually, PyTorch is used either as:
a replacement for NumPy to use the power of GPUs.
a deep learning research platform that provides maximum flexibility and speed.
Elaborating further:
A GPU-Ready Tensor Library
If you use NumPy, then you have used Tensors (a.k.a. ndarray).
Tensor illustration
PyTorch provides Tensors that can live either on the CPU or the GPU and accelerates the computation by a huge amount.
We provide a wide variety of tensor routines to accelerate and fit your scientific computation needs such as slicing, indexing, math operations, linear algebra, reductions. And they are fast!
Dynamic Neural Networks: Tape-Based Autograd
PyTorch has a unique way of building neural networks: using and replaying a tape recorder.
Most frameworks such as TensorFlow, Theano, Caffe, and CNTK have a static view of the world. One has to build a neural network and reuse the same structure again and again. Changing the way the network behaves means that one has to start from scratch.
With PyTorch, we use a technique called reverse-mode auto-differentiation, which allows you to change the way your network behaves arbitrarily with zero lag or overhead. Our inspiration comes from several research papers on this topic, as well as current and past work such as torch-autograd, autograd, Chainer, etc.
While this technique is not unique to PyTorch, it’s one of the fastest implementations of it to date. You get the best of speed and flexibility for your crazy research.
Dynamic graph
Python First
PyTorch is not a Python binding into a monolithic C++ framework. It is built to be deeply integrated into Python. You can use it naturally like you would use NumPy / SciPy / scikit-learn etc. You can write your new neural network layers in