已合并
test(nn): add test for fx.tracer.call_module_2.9.0 #38070
咿咿呀呀创建于 6月10日
test(nn): add test for fx.tracer.call_module_2.9.0 #38070
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 咿咿呀呀 的贡献)ascend-robot
6月10日 评论:
6月10日 评论:
6月10日 添加了label:ascend-cla/yes
ascend-robot
6月10日 评论:
6月10日 评论:
ascend-robot
6月10日 评论:
6月10日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| test | ✅ 李伟, sunyu-xuan (2/2) | ✅ 李伟 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)


ascend-robot
6月10日 评论:
6月10日 评论:
当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.12.0 | ||
| v2.11.0 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.7.1 | ||
| v2.7.1-26.1.0 | ||
| v2.9.0-26.1.0 | ||
| v2.12.0-26.1.0 | ||
| v2.11.0-26.1.0 | ||
| v2.10.0-26.1.0 | ||
| ci-test | ||
| sync-pr28113--to-v2.9.0 |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


ascend-robot
6月10日 评论:
6月10日 评论:
Ascend docs pipeline is running...


6月10日 添加了label:docs-ci-pipeline-running
6月10日 添加了label:ci-pipeline-running
ascend-robot
6月10日 评论:
6月10日 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


6月10日 删除了label:docs-ci-pipeline-running
6月10日 添加了label:docs-ci-pipeline-success
ascend-robot
6月10日 评论:
6月10日 评论:
Ascend docs pipeline is running...


6月10日 删除了label:docs-ci-pipeline-success
6月10日 添加了label:docs-ci-pipeline-success
6月10日 添加了label:docs-ci-pipeline-running
ascend-robot
6月10日 评论:
6月10日 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


6月10日 删除了label:docs-ci-pipeline-running
6月10日 删除了label:ci-pipeline-running
6月10日 添加了label:ci-pipeline-passed
ascend-robot
6月10日 评论:
6月10日 评论:
流水线 PR-pipeline_pytorch#30878 已完成
| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| CodeCheck_lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |


sunyu-xuan
6月10日 评论:
6月10日 评论:
/lgtm


6月10日 添加了label:approvedlgtm
6月10日 合入了pull request
ascend-robot
6月10日 评论:
6月10日 评论:
流水线 pytorch_gitcode_PR_multiVersion#10428 [ commitID:cc34d393 ] 已完成


【合入来源】
[Usage]: pytorch社区用例缺少对torch.fx.Tracer.call_module的测试,在现有test/fx/test_fx_tracer_transformer_api.py中补充用例验证NPU正确性
API 功能
API:
torch.fx.Tracer.call_module
功能:
Tracer.call_module是 PyTorch FX 符号追踪(Symbolic Tracing)过程中的核心钩子函数之一,它充当了模块调用行为与 FX 计算图节点之间的转换桥梁。torch.fx.Tracer.call_module的主要职责是在追踪(Trace)阶段,拦截对nn.Module子模块的调用操作,并将其转化为计算图(Graph)中的一个 call_module 节点。在 PyTorch FX 的设计中,Tracer 通过该方法完成模块调用的符号化记录,确保模型中的子模块调用能够被正确转换为计算图节点,同时保留模块名称、参数传递、节点依赖等关键信息,为后续计算图优化、代码生成、模型转换等流程提供可靠的结构支撑,是 FX 追踪流程中模块调用节点生成的核心环节。【修改方案】
一、追加到现有文件而非新建
test/fx/test_fx_tracer_transformer_api.py 已是 Tracer/Transformer API 的聚合测试文件(含 trace、path_of_module、iter、keys、proxy、to_bool、getattr 等),fx.Tracer.call_module 同属 Tracer 方法,追加到该文件中可避免文件碎片化,便于后期维护。
二、在test/fx/test_fx_tracer_transformer_api.py中追加用例进行全场景、全维度、全覆盖测试。
主要内容包含setUp → 初始化 Tracer / Graph、_create_placeholder → 工具函数、13 个完整测试用例。
新增 TestTracerCallModule测试用例说明表
三、NPU适配
【资料变更】
已经在 https://gitcode.com/Ascend/pytorch/treeN2.7.1/docs/zh/native apis 的文档中进行查找与验证。该目录下的pytorch.2-7.1至pytorch.2-12-0文件夹下的torch-fx.md已经对"torch.fx.Tracer.call_module"全部标注"是"。无需更改。
【接口变更】
【功能验证】
测试文件路径
test/fx/test_fx_tracer_transformer_api.py
验证环境
对应版本:torch-npu 2.9.0
操作系统:AlmaLinux 8.10
CANN 软件版本:8.5.0
安装的软件版本:torch、torch-npu 2.9.0
验证结果
结果说明
测试用例执行通过。
【CheckList】