PyTorch
Deep learning framework with tensors and dynamic neural networks with GPU support.
3. Used by agents' projects
Dependency in 96 public GitHub projects set up for AI coding agents that we scanned (1.5%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
pytorch.org/llms.txtFrom the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What PyTorch does
PyTorch's README pitches it as Python-first and imperative: each line executes when it is reached, and tape-based autograd lets a network change its behavior from one run to the next.
PyTorch popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How PyTorch is used
- PyTorch is a dependency in 96 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.9% of the 1,623 Python ones), #5 of 293 in ml and data science.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,057; those are left out of every share on this page.
- Projects that use it most often also use NumPy (79.2%), Hugging Face Transformers (60.4%), pandas (56.2%).
- It is more common in projects set up for OpenClaw (4.5%) than for Claude Code (1.4%).
By coding agent
Often used with
PyTorch in practice
Strengths
The README says that when you execute a line of code, it gets executed, and that there is no 'asynchronous view of the world'. It says error messages and stack traces are straightforward to understand, because the stack trace points to exactly where your code was defined.
The maintainers write that PyTorch uses reverse-mode auto-differentiation, which they say lets you change how a network behaves 'arbitrarily with zero lag or overhead'. The README also notes that the technique is not unique to PyTorch.
The maintainers say PyTorch is built into Python rather than bound onto a C++ framework. The same section says you can write new neural network layers in Python itself and use packages such as Cython and Numba.
For layers written in C/C++, the README describes an extension API with 'minimal boilerplate'. It links a tutorial and an example repo.
Watch out for
A source build needs Python 3.10 or later, a compiler that fully supports C++20, at least 10 GB of free disk space, and 30-60 minutes for the first build. The README says later rebuilds are much faster.
The build instructions say ROCm support for AMD GPUs works only on Linux. Intel GPU support covers Linux and Windows.
The Windows build notes call distributed package support on Windows a prototype feature that is subject to changes.
More about PyTorch
Agent Skills for it
- pytorch-lightning: Deep learning framework (PyTorch Lightning / lightning package). Organize PyTorch code into LightningModules, configure Trainers for multi-G
- pytorch-fsdp2: Adds PyTorch FSDP2 (fully_shard) to training scripts with correct init, sharding, mixed precision/offload config, and distributed checkpoint
- torch-profiler-layer-track: Add verified layer-number guides and compact GPU display lanes to an existing Torch Profiler Chrome JSON trace. Use for L0/L1/... navigation
Packages around it
- numpy: Array computing
- pandas: DataFrames
- transformers: Pretrained models
- scikit-learn: Classical ML
- python-dotenv: Env config
- requests: HTTP client
More in ML and data science
Alternatives
PyTorch This page
Get started
Install it.
pip install torchRules for your agent
## PyTorch
- Take the install command from the selector at https://pytorch.org/get-started/locally/ instead of writing one from memory. The command depends on OS, package and compute platform.
- The selector labels Stable as 2.7.0, while the latest GitHub release is v2.14.1. Confirm which version the command installs before pinning.
- The site says latest Stable PyTorch requires Python 3.10 or later. Check the project's Python version before installing.
- Use the Stable build unless the user asks for Preview. Preview builds are nightly and not fully tested and supported.
- For inference, move the model to its device and call `.eval()`, then run it inside `with torch.no_grad():`, as the Hub SSD example does.
- When building from source without a given GPU toolkit, export `USE_CUDA=0`, `USE_ROCM=0` or `USE_XPU=0` to disable that backend.