A minimal deep learning framework with a PyTorch-like tensor API, autograd, a compiler, and support for many accelerator backends.
pytorch/pytorch
A Python deep learning framework offering GPU-accelerated tensor computation and dynamic neural networks built on autograd.
Open-source alternative to:TensorFlow
MATLAB
- Stars
- 104,939
- Forks
- 32,419
- Open issues
- 17,651
- Last commit
- 6 hours ago
What is it?
PyTorch is a Python package for two main purposes: tensor computation similar to NumPy, with strong GPU acceleration, and building deep neural networks on a tape-based autograd system. Tensors can live on the CPU or GPU, and the library includes a wide range of routines for slicing, indexing, math, linear algebra and reductions.
Neural networks in PyTorch are built and run imperatively, so the graph can change on every execution rather than being fixed ahead of time. The project is designed to integrate with the Python ecosystem, letting developers use NumPy, SciPy and Cython alongside it, and offers C++ extension APIs for custom layers.
The repository also covers building from source with CUDA, ROCm and Intel GPU support, plus Docker images and prebuilt wheels for Linux, macOS and Windows.
Key features
- 01GPU-accelerated tensors with a NumPy-like API
- 02Tape-based autograd for automatic differentiation of tensor operations
- 03Dynamic computation graphs that can change on each run
- 04torch.nn library for building neural network layers and models
- 05C++ extension API for writing custom operations
Use cases
- Training deep learning models on NVIDIA, AMD or Intel GPUs
- Prototyping research models that need flexible, changing network structures
- Using GPU-accelerated NumPy-style computation in scientific workloads
- Building custom neural network layers in Python or C++
Quick start
- 1
Install prebuilt binaries via Conda or pip using the commands on the official website
- 2
Clone the PyTorch source code
git clone https://github.com/pytorch/pytorch - 3
Install development dependencies from the PyTorch directory
pip install --group dev - 4
Build and install PyTorch in editable mode
python -m pip install --no-build-isolation -v -e .
Things to know
- Building from source needs at least 10 GB of disk space and 30-60 minutes for the first build.
- Source builds require a C++20 compiler, such as gcc 11.3 or newer on Linux.
- The license is not clearly identified in the project metadata, so check the LICENSE file before commercial use.
Topics
FAQ
- What is pytorch?
- A Python deep learning framework offering GPU-accelerated tensor computation and dynamic neural networks built on autograd. PyTorch is a Python package for two main purposes: tensor computation similar to NumPy, with strong GPU acceleration, and building deep neural networks on a tape-based autograd system. Tensors can live on the CPU or GPU, and the library includes a wide range of routines for slicing, indexing, math, linear algebra and reductions.
- Is pytorch free to use? What license does it have?
- pytorch is open source under the Other license. Check the license terms before using it in commercial products.
- Is pytorch still maintained?
- Actively maintained. The last commit to pytorch was on Oct 21, 2026.
- What can I use pytorch for?
- Training deep learning models on NVIDIA, AMD or Intel GPUs Prototyping research models that need flexible, changing network structures Using GPU-accelerated NumPy-style computation in scientific workloads Building custom neural network layers in Python or C++
- How do I install pytorch?
- Install prebuilt binaries via Conda or pip using the commands on the official website Clone the PyTorch source code: git clone https://github.com/pytorch/pytorch Install development dependencies from the PyTorch directory: pip install --group dev Build and install PyTorch in editable mode: python -m pip install --no-build-isolation -v -e .
- Where can I get pytorch?
- The source code and installation instructions are on GitHub: https://github.com/pytorch/pytorch
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An end-to-end open source platform for building and deploying machine learning models, with Python and C++ APIs.
A learn-by-building ML course: a from-scratch NumPy deep learning framework (CLI modules) plus 350+ browser-based coding questions graded in Pyodide.
Keras 3 is a deep learning framework that runs on JAX, TensorFlow, PyTorch, or OpenVINO for inference.
AI-oriented quantitative investment platform from Microsoft covering data, model training, backtesting and order execution for quant research.
Ray is a unified framework for scaling Python and AI applications from a laptop to a cluster, with a distributed runtime and AI libraries.