已开启
【社区任务】7月社区任务第二期-Ascend for PyTorch API 一致性开发(32) #2956
yi_jiabin创建于 7月16日
7月18日 关联了pull request:[Task-32/33][v2.7.1] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.7.1] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.9.0] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.9.0] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.11.0] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.11.0] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.12.0] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][v2.12.0] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][master] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月18日 关联了pull request:[Task-32/33][master] API Consistency: torch.autograd.gradcheck & torch.autograd.profiler.emit_itt
7月28日 添加了label:bot-triaged
TorchNPU-Bot
7月28日 评论:
7月28日 评论:
检测到当前 issue 已关联 PR !42011,自动添加标签:bot-triaged


Yhw050920
25 天前 评论:
25 天前 评论:
Yhw050920
25 天前 评论:
25 天前 评论:
验证说明
API 类型
torch.autograd.gradcheck / torch.autograd.gradgradcheck 为纯 Python 接口,不涉及硬件算子。按新验收标准 1.2 ①,无需新增用例,仅提交 issue 说明 + 运行截图 + 验证支持情况。
支持情况验证
Ascend NPU 不支持 float64 的 linalg.vector_norm、dot、mm、relu 等算子,因此:
- fast_mode=True 无法在 NPU 上运行(内部 linalg.vector_norm 不支持 float64)
- slow_mode=False 在 NPU 上支持 float64 的 mul、sin/cos、exp、sum、线性函数等运算
验证命令:
import torch
from torch.autograd import gradcheck, gradgradcheck
def f(x): return x.mul(5)
x = torch.rand(10, dtype=torch.float64, device="npu", requires_grad=True)
gradcheck(f, x, fast_mode=False) # True
gradgradcheck(f, x, fast_mode=False) # True
运行截图



Yhw050920
25 天前 评论:
25 天前 评论:
API 一致性验证说明已提交:https://gitcode.com/Ascend/pytorch/issues/4029


一、任务概览
Ascend for PyTorch是昇腾 NPU 适配 PyTorch 框架的核心插件,为 PyTorch 提供完整的昇腾硬件算子支持、调度能力与推理优化,保障 PyTorch 模型可在昇腾 NPU 上无缝、高效运行。
当前 PyTorch 官方原生 API 已形成完善体系,但部分API尚未在 Ascend for PyTorch 中完成实现、对齐与验证,导致部分 PyTorch 原生模型 / 代码在昇腾 NPU 上运行时出现接口报错、功能不一致等问题。
本任务邀请开发者参与Ascend for PyTorch API 补齐与适配验证,完成缺失 API 的开发、调试、测试与文档交付,完善 Torch-NPU 对 PyTorch 原生 API 的兼容性,提升昇腾 NPU 上 PyTorch 框架的易用性与模型适配覆盖率。
二、任务要求及参考指导
https://docs.qq.com/doc/DT3R3eVNWdm1yUkdR
三、任务价值
深度参与昇腾生态 + PyTorch 开源共建,贡献代码合入官方仓库;
掌握 NPU PyTorch 框架适配、异构计算核心技能;
获得开源社区认可,积累工业级实习项目经验,提升简历竞争力。
四、任务领取
请前往昇腾社区-任务广场领取任务:https://www.hiascend.com/activities/task-center ,其余领取方式无效。(昇腾社区任务发布会滞后,请耐心等候)
五、API名称
torch.autograd.gradcheck