PyTorch documentation
发布时间:2026-08-12 | 浏览:1
PyTorch is an optimized tensor library for deep learning using GPUs and CPUs.
Features described in this documentation are classified by release status:
Stable (API-Stable): These features will be maintained long-term and there should generally be no major performance limitations or gaps in documentation. We also expect to maintain backwards compatibility (although breaking changes can happen and notice will be given one release ahead of time).
Unstable (API-Unstable): Encompasses all features that are under active development where APIs may change based on user feedback, requisite performance improvements or because coverage across operators is not yet complete. The APIs and performance characteristics of these features may change.
Install PyTorch
User Guide PyTorch Overview Get Started Learn the Basics PyTorch Main Components Torch.compile Torch.export Developer Notes Accelerator Integration
PyTorch Overview
Learn the Basics
PyTorch Main Components
Developer Notes
Accelerator Integration
Reference API C++ torch torch.nn torch.nn.functional torch.Tensor Tensor Attributes Tensor Views torch.amp torch.autograd torch.library torch.accelerator torch.cpu torch.cuda torch.cuda.memory torch.mps torch.xpu torch.mtia torch.mtia.memory torch.mtia.mtia_graph Meta device torch.backends torch.export torch.distributed torch.distributed.tensor torch.distributed.algorithms.join torch.distributed.elastic torch.distributed.fsdp torch.distributed.fsdp.fully_shard torch.distributed.tensor.parallel torch.distributed.optim torch.distributed.pipelining torch.distributed._symmetric_memory torch.distributed.checkpoint torch.distributions torch.compiler torch.fft torch.func torch.futures torch.fx torch.fx.experimental torch.hub torch.linalg torch.monitor torch.signal torch.special torch.overrides torch.nativert torch.package torch.profiler torch.nn.init torch.nn.attention torch.onnx torch.optim Complex Numbers DDP Communication Hooks Quantization Distributed RPC Framework torch.random torch.masked torch.nested torch.Size torch.sparse torch.Storage torch.testing torch.utils torch.utils.backend_registration torch.utils.hooks torch.utils.throughput_benchmark torch.utils.collect_env torch.utils.flop_counter torch.utils.hipify.hipify_python Benchmark Utils - torch.utils.benchmark torch.utils.benchmark.examples torch.utils.benchmark.examples.spectral_ops_fuzz_test torch.utils.checkpoint torch.utils.cpp_extension torch.utils.data torch.utils.deterministic JIT Utils - torch.utils.jit torch.utils.jit.log_extract torch.utils.dlpack torch.utils.mobile_optimizer torch.utils.model_zoo torch.utils.tensorboard torch.utils.module_tracker Type Info torch.__config__ torch.__future__ torch._logging Torch Environment Variables
torch.nn.functional
Tensor Attributes
torch.accelerator
torch.cuda.memory
torch.mtia.memory
torch.mtia.mtia_graph
torch.distributed
torch.distributed.tensor
torch.distributed.algorithms.join
torch.distributed.elastic
torch.distributed.fsdp
torch.distributed.fsdp.fully_shard
torch.distributed.tensor.parallel
torch.distributed.optim
torch.distributed.pipelining
torch.distributed._symmetric_memory
torch.distributed.checkpoint
torch.distributions
torch.fx.experimental
torch.overrides
torch.nn.attention
Complex Numbers
DDP Communication Hooks
Distributed RPC Framework
torch.utils.backend_registration
torch.utils.hooks
torch.utils.throughput_benchmark
torch.utils.collect_env
torch.utils.flop_counter
torch.utils.hipify.hipify_python
Benchmark Utils - torch.utils.benchmark
torch.utils.benchmark.examples
torch.utils.benchmark.examples.spectral_ops_fuzz_test
torch.utils.checkpoint
torch.utils.cpp_extension
torch.utils.data
torch.utils.deterministic
JIT Utils - torch.utils.jit
torch.utils.jit.log_extract
torch.utils.dlpack
torch.utils.mobile_optimizer
torch.utils.model_zoo
torch.utils.tensorboard
torch.utils.module_tracker
torch.__config__
torch.__future__
Torch Environment Variables
Developer Notes Automatic Mixed Precision examples Autograd mechanics Broadcasting semantics CPU threading and TorchScript inference CUDA semantics PyTorch Custom Operators Landing Page Distributed Data Parallel Extending PyTorch Extending torch.func with autograd.Function Frequently Asked Questions Getting Started on Intel GPU Gradcheck mechanics HIP (ROCm) semantics Features for large-scale deployments LibTorch Stable ABI LocalTensor Tutorial: Single-Process SPMD Debugging MKLDNN backend Modules MPS backend Multiprocessing best practices Numerical accuracy Out Notes Reproducibility Serialization semantics TensorIterator (Python) Windows FAQ
Automatic Mixed Precision examples
Autograd mechanics
Broadcasting semantics
CPU threading and TorchScript inference
PyTorch Custom Operators Landing Page
Distributed Data Parallel
Extending PyTorch
Extending torch.func with autograd.Function
Frequently Asked Questions
Getting Started on Intel GPU
Gradcheck mechanics
HIP (ROCm) semantics
Features for large-scale deployments
LibTorch Stable ABI
LocalTensor Tutorial: Single-Process SPMD Debugging
Multiprocessing best practices
Numerical accuracy
Reproducibility
Serialization semantics
TensorIterator (Python)
Community The Ultimate Guide to PyTorch Contributions PyTorch Governance | Build + CI PyTorch Contribution Guide PyTorch Design Philosophy PyTorch Governance | Mechanics PyTorch Governance | Maintainers
The Ultimate Guide to PyTorch Contributions
PyTorch Governance | Build + CI
PyTorch Contribution Guide
PyTorch Design Philosophy
PyTorch Governance | Mechanics
PyTorch Governance | Maintainers
Indices and tables #
PyTorch on XLA Devices
Access comprehensive developer documentation for PyTorch
Get in-depth tutorials for beginners and advanced developers
Find development resources and get your questions answered
To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy .