PyTorch 文档¶
PyTorch 是一个针对使用 GPU 和 CPU 进行深度学习而优化的张量库。
本说明文档中描述的功能按发布状态分类
稳定:这些功能将长期维护,并且通常没有重大的性能限制或文档中的空白。我们还希望保持向后兼容性(尽管可能会发生重大更改,并且会在提前一个版本时发出通知)。
Beta:这些功能标记为 Beta,因为 API 可能会根据用户反馈而更改,因为性能需要提高,或者因为运算符的覆盖范围尚未完成。对于 Beta 功能,我们致力于将该功能贯彻到稳定分类。然而,我们不承诺向后兼容性。
原型:这些功能通常不作为二进制发行版(如 PyPI 或 Conda)的一部分提供,有时除运行时标志外,并且处于早期阶段,用于反馈和测试。
开发者笔记
语言绑定
Python API
- torch
- torch.nn
- torch.nn.functional
- torch.Tensor
- 张量属性
- 张量视图
- torch.amp
- torch.autograd
- torch.library
- torch.cpu
- torch.cuda
- StreamContext
- torch.cuda.can_device_access_peer
- torch.cuda.current_blas_handle
- torch.cuda.current_device
- torch.cuda.current_stream
- torch.cuda.default_stream
- device
- torch.cuda.device_count
- device_of
- torch.cuda.get_arch_list
- torch.cuda.get_device_capability
- torch.cuda.get_device_name
- torch.cuda.get_device_properties
- torch.cuda.get_gencode_flags
- torch.cuda.get_sync_debug_mode
- torch.cuda.init
- torch.cuda.ipc_collect
- torch.cuda.is_available
- torch.cuda.is_initialized
- torch.cuda.memory_usage
- torch.cuda.set_device
- torch.cuda.set_stream
- torch.cuda.set_sync_debug_mode
- torch.cuda.stream
- torch.cuda.synchronize
- torch.cuda.utilization
- torch.cuda.temperature
- torch.cuda.power_draw
- torch.cuda.clock_rate
- torch.cuda.OutOfMemoryError
- 随机数生成器
- 通信集合
- 流和事件
- 图(测试版)
- 内存管理
- NVIDIA 工具扩展 (NVTX)
- Jiterator(测试版)
- 流清理器(原型)
- 了解 CUDA 内存使用情况
- 生成快照
- 使用可视化工具
- 快照 API 参考
- torch.mps
- torch.xpu
- StreamContext
- torch.xpu.current_device
- torch.xpu.current_stream
- device
- torch.xpu.device_count
- device_of
- torch.xpu.empty_cache
- torch.xpu.get_device_capability
- torch.xpu.get_device_name
- torch.xpu.get_device_properties
- torch.xpu.init
- torch.xpu.is_available
- torch.xpu.is_initialized
- torch.xpu.set_device
- torch.xpu.set_stream
- torch.xpu.stream
- torch.xpu.synchronize
- 随机数生成器
- 流和事件
- 元设备
- torch.backends
- torch.export
- torch.distributed
- torch.distributed.algorithms.join
- torch.distributed.elastic
- torch.distributed.fsdp
- torch.distributed.optim
- torch.distributed.tensor.parallel
- torch.distributed.checkpoint
save()
async_save()
save_state_dict()
load()
load_state_dict()
Stateful
StorageReader
StorageWriter
LoadPlanner
LoadPlan
ReadItem
SavePlanner
SavePlan
WriteItem
FileSystemReader
FileSystemWriter
FsspecReader
FsspecWriter
DefaultSavePlanner
DefaultLoadPlanner
get_state_dict()
get_model_state_dict()
get_optimizer_state_dict()
set_state_dict()
set_model_state_dict()
set_optimizer_state_dict()
StateDictOptions
dcp_to_torch_save()
torch_save_to_dcp()
BroadcastingTorchSaveReader
DynamicMetaLoadPlanner
- torch.distributions
- torch.compiler
- torch.fft
- torch.func
- torch.futures
- torch.fx
- torch.fx.experimental
- torch.hub
- torch.jit
- torch.linalg
- torch.monitor
- torch.signal
- torch.special
- torch.overrides
- torch.package
- torch.profiler
- torch.nn.init
- torch.nn.attention
- torch.onnx
- torch.optim
- 复数
- DDP 通信挂钩
- 管道并行
- 量化
- 分布式 RPC 框架
- torch.random
- torch.masked
- torch.nested
- torch.sparse
- torch.Storage
- torch.testing
- torch.utils
- torch.utils.benchmark
- torch.utils.bottleneck
- torch.utils.checkpoint
- torch.utils.cpp_extension
- torch.utils.data
- torch.utils.deterministic
- torch.utils.jit
- torch.utils.dlpack
- torch.utils.mobile_optimizer
- torch.utils.model_zoo
- torch.utils.tensorboard
- 类型信息
- 命名张量
- 命名张量运算符覆盖范围
- torch.__config__
- torch.__future__
- torch._logging
- Torch 环境变量