什麼是 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