TechnologyMachine learning framework

PyTorch

Open-source machine learning framework combining GPU-accelerated tensors with automatic differentiation, widely used for deep learning research.

PyTorch is an open-source machine learning framework for building and training neural networks. Its core is a tensor library, similar to NumPy arrays but able to run on GPUs and other accelerators, combined with an automatic differentiation engine called autograd that computes the gradients needed for backpropagation. Users define models as ordinary Python classes, and higher-level modules provide layers, loss functions, optimizers and data loading utilities for tasks in vision, language, audio and other domains.

Facebook's AI research lab released PyTorch in 2016, building on ideas and C libraries from Torch, an earlier framework scripted in Lua. Its defining feature was define-by-run execution: the computation graph is built as the code runs, so models can use normal Python control flow and be inspected with standard debugging tools. This flexibility made it especially popular with researchers, and it became the most widely used framework in academic deep learning. Version 2.0, released in 2023, added a compiler interface, torch.compile, that speeds up models while keeping the familiar eager programming style.

In 2022 governance of PyTorch moved to the PyTorch Foundation, part of the Linux Foundation, with Meta and other technology companies as members. Much of the open AI ecosystem builds on it, including Hugging Face Transformers and many openly released models, and it relies on vendor libraries such as CUDA to run efficiently on hardware. Its main rival has been TensorFlow, and alternatives such as JAX also compete. PyTorch is often the practical starting point for anyone learning to implement deep learning models from scratch.

Key points

  • PyTorch combines GPU-accelerated tensors with automatic differentiation for training neural networks.
  • Define-by-run execution lets models use ordinary Python control flow and debugging tools.
  • Facebook AI Research released PyTorch in 2016, building on the earlier Lua-based Torch framework.
  • Since 2022 the project has been governed by the PyTorch Foundation under the Linux Foundation.

Related entries

Technology

TensorFlow

AIProgrammingFOSS

Open-source machine learning library from Google for building, training and deploying neural networks on CPUs, GPUs, TPUs and mobile devices.

Glossary term

Approach to machine learning that trains neural networks with many layers to learn increasingly abstract representations directly from raw data.

Glossary term

Computational model made of interconnected units, loosely inspired by biological neurons, whose connection strengths are learned from data.

Technology

CUDA

HardwareAIProgramming

Proprietary parallel computing platform and programming model from NVIDIA that lets developers run general-purpose code on its GPUs.

Technology

Hugging Face Transformers

AIProgrammingFOSS

Open-source Python library from Hugging Face that provides a common interface for loading, running and fine-tuning thousands of pretrained models.

Technology

Python

Programming

High-level, general-purpose programming language created by Guido van Rossum, known for readable syntax and widely used in data science and AI.

Technology

Jupyter

ProgrammingAIFOSS

Open-source project for interactive computing whose notebooks combine live code, results, equations and narrative text in one document.

Glossary term

Gradient Descent

AIProgramming

Optimization method that repeatedly adjusts parameters in the direction that most reduces a function's value, used to train most machine learning models.

Featured in guides

Referenced by

Other entries that discuss or point to PyTorch.