Table of Contents
2.3 ▼
社区
PyTorch 治理 | 构建 + CI
PyTorch 贡献指南
PyTorch 设计哲学
PyTorch 治理 | 机制
PyTorch 治理 | 维护者
开发者笔记
CUDA 自动混合精度示例
自动求导机制
广播语义
CPU 线程与 TorchScript 推理
CUDA 语义
分布式数据并行
扩展 PyTorch
使用 autograd.Function 扩展 torch.func
常见问题
FSDP 笔记
梯度检查机制
HIP (ROCm) 语义
大规模部署的功能
模块
MPS 后端
多进程最佳实践
数值精度
可重复性
序列化语义
Windows 常见问题
语言绑定
C++
Javadoc
torch::deploy
Python API
torch
torch.nn
torch.nn.functional
torch.Tensor
张量属性
张量视图
torch.amp
torch.autograd
torch.library
torch.cpu
torch.cuda
理解CUDA内存使用
生成快照
使用可视化工具
快照API参考
torch.mps
torch.xpu
元设备
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
torch.distributions
torch.compiler
torch.fft
torch.func
torch.futures
torch.fx
torch.fx.experimental
torch.hub
torch.jit
torch.linalg
torch.monitor
torch.信号
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.存储
torch.testing
torch.utils
torch.utils.benchmark
torch.utils.bottleneck
torch.utils.checkpoint
torch.utils.cpp_extension
torch.utils.数据
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._日志记录
Torch 环境变量
库
torchaudio
TorchData
TorchRec
TorchServe
torchtext
torchvision
PyTorch on XLA Devices
Docs
>
torch.xpu
>
torch.xpu.current_device
Shortcuts
torch.xpu.current_device
¶
torch.xpu.
current_device
(
)
[源代码]
¶
返回当前选定设备的索引。
Return type
int
torch.xpu.current_device
current_device()