·torch_npu

华为Ascend Extension for PyTorch(torch_npu)环境检查、部署和能力指南。当用户使用@torch_npu、Ascend NPU、CANN或需要将PyTorch迁移到NPU时自动应用;当用户使用@torch_npu_doc时,根据技能参考文档提供项目内中文文档能力描述。

14安装·1热度·@ascend-ai-coding

安装

$npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill torch_npu

如何安装 torch_npu

通过命令行快速安装 torch_npu AI 技能到你的开发环境

  1. 打开终端: 打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等)
  2. 运行安装命令: 复制并运行以下命令:npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill torch_npu
  3. 验证安装: 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用

来源:ascend-ai-coding/awesome-ascend-skills。

SKILL.md

查看原文

检查 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_npu
分类
</>开发工具
认证
收录时间
2026-03-09
更新时间
2026-03-10

Browse more skills from ascend-ai-coding/awesome-ascend-skills

快速解答

什么是 torch_npu?

华为Ascend Extension for PyTorch(torch_npu)环境检查、部署和能力指南。当用户使用@torch_npu、Ascend NPU、CANN或需要将PyTorch迁移到NPU时自动应用;当用户使用@torch_npu_doc时,根据技能参考文档提供项目内中文文档能力描述。 来源:ascend-ai-coding/awesome-ascend-skills。

如何安装 torch_npu?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/ascend-ai-coding/awesome-ascend-skills --skill torch_npu 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code、Cursor 或 OpenClaw 中使用

这个 Skill 的源码在哪?

https://github.com/ascend-ai-coding/awesome-ascend-skills

详情

分类
</>开发工具
来源
skills.sh
收录时间
2026-03-09