pytorch/pytorch
Dependencies
Runtime Python dependencies
From requirements.txt (top-level pinning) and setup.py:
| Package | Why PyTorch needs it |
|---|---|
numpy |
Tensor ↔ ndarray interop |
typing_extensions |
Backports of typing features |
sympy |
SymInt / dynamic-shape symbolic reasoning in compile stack |
networkx |
FX graph utilities |
jinja2 |
Codegen templates |
fsspec |
Async checkpointing (torch.distributed.checkpoint) |
filelock |
Inductor cache locking |
mpmath |
Required by sympy |
setuptools |
Distutils replacement |
Optional Python dependencies (specific features)
| Package | Feature |
|---|---|
triton |
Inductor CUDA kernel codegen (CUDA wheels bundle this) |
tensorboard |
Profiler trace viewer + torch.utils.tensorboard |
onnx |
torch.onnx.export |
pytest |
Running test files via pytest (test/run_test.py uses unittest) |
expecttest |
assertExpectedInline |
hypothesis |
Property-based tests |
Native libraries
Linked at build / runtime:
| Library | Backend | Purpose |
|---|---|---|
| Intel MKL / oneAPI | CPU | BLAS/LAPACK on x86 |
| OpenBLAS / NVPL | CPU | BLAS/LAPACK on aarch64 |
| oneDNN (MKLDNN) | CPU | Optimized conv / matmul on x86 |
| FBGEMM | CPU | Quantized GEMM, embedding table ops |
| NNPACK / XNNPACK | CPU | Mobile-oriented conv kernels |
| OpenMP | CPU | Threaded loops |
| cuBLAS | CUDA | BLAS |
| cuDNN | CUDA | Conv / pooling / RNN kernels |
| cuSPARSE | CUDA | Sparse |
| cuSolver | CUDA | LAPACK on CUDA |
| MAGMA | CUDA (opt) | Heterogeneous LAPACK |
| cuFFT | CUDA | FFT |
| NCCL | CUDA | Multi-GPU collectives |
| CUTLASS | CUDA (opt) | GEMM kernel templates |
| FlashAttention | CUDA | Bundled fused attention |
| Triton | CUDA | Inductor codegen target |
| rocBLAS, hipBLAS, MIOpen | ROCm | AMD equivalents |
| RCCL | ROCm | NCCL equivalent |
| MPS framework | Apple | macOS GPU |
| oneAPI / SYCL | XPU | Intel GPU |
Submodules
third_party/ contains git submodules. Selected major ones:
| Submodule | What |
|---|---|
third_party/nccl |
NCCL |
third_party/cudnn_frontend |
cuDNN v8 frontend |
third_party/cutlass |
CUTLASS |
third_party/fbgemm |
FBGEMM |
third_party/onnx |
ONNX schema definitions |
third_party/protobuf |
Caffe2 + ONNX proto |
third_party/pybind11 |
Python bindings |
third_party/eigen |
Linear algebra (some legacy paths) |
third_party/sleef |
CPU vector math (sin, cos, etc.) |
third_party/kineto |
Kineto profiler |
third_party/foxi / onnx-tensorrt |
TRT integration |
third_party/XNNPACK, NNPACK, pthreadpool, cpuinfo |
Mobile kernels |
third_party/opentelemetry-cpp |
OpenTelemetry |
third_party/composable_kernel |
AMD kernel library |
The .gitmodules file is the source of truth.
Versioning policy
- Submodules are pinned by SHA. Updates require an explicit PR.
- Native dependency versions (cuDNN, NCCL, MKL) are pinned in
cmake/External/and the workflow definitions. - Python deps are pinned by version range in
setup.py; the test/dev requirements have stricter pins inrequirements*.txt.
Where to look
| File | Purpose |
|---|---|
requirements.txt, requirements-build.txt |
Build / runtime Python deps |
requirements-test.txt, requirements-ci.txt |
Test / CI deps |
setup.py |
Authoritative install_requires |
.gitmodules |
Native submodules |
cmake/External/ |
External native lib detection |
cmake/Dependencies.cmake |
Dependency wiring |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.