什么是 torch_npu?
华为Ascend Extension for PyTorch(torch_npu)环境检查、部署和能力指南。当用户使用@torch_npu、Ascend NPU、CANN或需要将PyTorch迁移到NPU时自动应用;当用户使用@torch_npu_doc时,根据技能参考文档提供项目内中文文档能力描述。 来源:ascend-ai-coding/awesome-ascend-skills。
华为Ascend Extension for PyTorch(torch_npu)环境检查、部署和能力指南。当用户使用@torch_npu、Ascend NPU、CANN或需要将PyTorch迁移到NPU时自动应用;当用户使用@torch_npu_doc时,根据技能参考文档提供项目内中文文档能力描述。
通过命令行快速安装 torch_npu AI 技能到你的开发环境
来源:ascend-ai-coding/awesome-ascend-skills。
检查 PyTorch 与 Python 版本是否在配套范围内(参见 README.zh.md 中的「PyTorch与Python版本配套表」):
| 设备与内存 | torch.npu:设备管理、devicecount、currentdevice、setdevice、synchronize、Stream/Event、内存统计与分配(memoryallocated、emptycache、MemPool 等)。 | | 张量/存储 | tensor.npu()、tensor.isnpu、NPU Storage、序列化 torch.save/load 支持 NPU,DDP/多进程 reductions。 | | 训练/优化 | torch.npu.amp 混合精度、torchnpu.optim、FSDP 补丁(ShardedGradScaler)、梯度检查点默认 NPU。 |
| 分布式 | torchnpu.distributed:HCCL/LCCL 后端、ishcclavailable、reinitprocessgroup、RPC、symmetric memory、DTensor 规则。 | | 扩展 API | torchnpu.contrib:NMS、IoU 系列、ROIAlign、DCN、FusedAttention、自定义模块(如 DropoutWithByteMask)等。 | | 图与编译 | NPU Graph(npugraphify)、Dynamo、Inductor、torch.compile 支持 NPU。 |
华为Ascend Extension for PyTorch(torch_npu)环境检查、部署和能力指南。当用户使用@torch_npu、Ascend NPU、CANN或需要将PyTorch迁移到NPU时自动应用;当用户使用@torch_npu_doc时,根据技能参考文档提供项目内中文文档能力描述。 来源:ascend-ai-coding/awesome-ascend-skills。
为搜索与 AI 引用准备的稳定字段与命令。
npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill torch_npuBrowse more skills from ascend-ai-coding/awesome-ascend-skills
华为Ascend Extension for PyTorch(torch_npu)环境检查、部署和能力指南。当用户使用@torch_npu、Ascend NPU、CANN或需要将PyTorch迁移到NPU时自动应用;当用户使用@torch_npu_doc时,根据技能参考文档提供项目内中文文档能力描述。 来源:ascend-ai-coding/awesome-ascend-skills。
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill torch_npu 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用
https://github.com/ascend-ai-coding/awesome-ascend-skills