已合并
[test] add symbolic_shapes coverage under fx tests #33902
[test] add symbolic_shapes coverage under fx tests #33902
已合并
baoxuebin_2026创建于 4月17日
baoxuebin_2026
4月17日

【合入来源】

如有社区issue,请关联issue链接

公开issue:暂无单独公开issue链接,本次提交对应 Torch-NPU API 补齐任务,涉及以下 5 个 API:

  • torch.fx.experimental.symbolic_shapes.is_accessor_node
  • torch.fx.experimental.symbolic_shapes.is_concrete_bool
  • torch.fx.experimental.symbolic_shapes.is_concrete_float
  • torch.fx.experimental.symbolic_shapes.is_concrete_int
  • torch.fx.experimental.symbolic_shapes.is_symbolic

【修改方案】

  1. 对目标 API 进行现状核查,确认在当前 PyTorch 2.9.0 + torch_npu 2.9.0rc1 环境中已实际支持,不需要补齐底层实现。
  2. 补充独立测试文件 test/npu/test_symbolic_shapes.py,覆盖以下场景:
    • is_accessor_nodecall_method / call_function 两类 accessor node 的识别
    • is_concrete_int / is_concrete_float / is_concrete_bool 对字面量输入的判定
    • ShapeEnv 生成的 SymInt / SymFloat / SymBool 的 symbolic 判定
    • NPU tensor shape 场景下的实际验证
  3. 采用最小化修改方案,不改动已有底层实现,仅补齐测试覆盖。

【资料变更】

不涉及。资料补齐已单独提交文档 PR。

【接口变更】

不涉及。未修改跨仓接口,也未修改客户面可见接口行为。

【功能验证】

测试场景:

  1. symbolic_shapes 相关 API 的 accessor / concrete / symbolic 核心行为验证
  2. NPU 设备下 tensor shape 场景验证

测试方法:

cd /data
TORCH_DEVICE_BACKEND_AUTOLOAD=1 /usr/local/python3.11.14/bin/python3 /data/pytorch/test/npu/test_symbolic_shapes.py -v

https://gitcode.com/Ascend/pytorch/issues/1616

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 baoxuebin_2026 的贡献)
baoxuebin_2026baoxuebin_2026
4月17日 创建了 pull request,commit 21377885
ascend-robot
ascend-robot成员
4月17日 评论:

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 李伟, yuhaiyan (2/2) 李伟 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

baoxuebin_2026, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
ascend-robotascend-robot成员
4月17日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
4月17日 评论:

当前仓库存在以下 保护分支

Protected Branch Version Release
master
v2.8.0
v2.9.0
v2.10.0
v2.7.1
v2.11.0

评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作

注意:

  1. /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
  2. 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭
likedislike
ascend-robotascend-robot成员
4月17日 添加了label:ci-pipeline-running
baoxuebin_2026
baoxuebin_2026
4月17日 评论:

compile

likedislike
ascend-robotascend-robot成员
4月17日 删除了label:ci-pipeline-running
ascend-robot
ascend-robot成员
4月17日 评论:
流水线 PR-pipeline_pytorch#15885 已终止运行
阶段 任务名 状态 详情
编译构建 Build_X86 🕚 >>>
Build_ARM 🕚 >>>
Build_LibTorch_x86 🕚 >>>
Build_X86_torchair 🕚 >>>
Build_ARM_torchair 🕚 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
check_error 🟨 >>>
开源片段检查 SCA >>>
开发者测试 UT_X86_Part_01 🕚 >>>
UT_X86_Part_02 🕚 >>>
UT_ARM_A3_Part_01 🕚 >>>
UT_ARM_A3_Part_02 🕚 >>>
UT_DIST_X86_Part_01 🕚 >>>
UT_DIST_X86_Part_02 🕚 >>>
UT_DIST_X86_Part_03 🕚 >>>
UT_DIST_X86_Part_04 🕚 >>>
UT_inductor_Part_01 🕚 >>>
UT_inductor_Part_02 🕚 >>>
UT_inductor_Part_03 🕚 >>>
UT_inductor_Part_04 🕚 >>>
UT_ARM_A2_Part_01 🕚 >>>
UT_ARM_A2_Part_02 🕚 >>>
流水线 PR-pipeline_pytorch 🟨 >>>
likedislike
ascend-robotascend-robot成员
4月17日 添加了label:ci-pipeline-running
ascend-robotascend-robot成员
4月17日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
4月17日 添加了label:ci-pipeline-failed
ascend-robot
ascend-robot成员
4月17日 评论:
流水线 PR-pipeline_pytorch#15890 运行失败
阶段 任务名 状态 详情
编译构建 Build_X86 🕚 >>>
Build_ARM 🕚 >>>
Build_LibTorch_x86 🕚 >>>
Build_X86_torchair 🕚 >>>
Build_ARM_torchair 🕚 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
check_error >>>
开源片段检查 SCA >>>
开发者测试 UT_X86_Part_01 🕚 >>>
UT_X86_Part_02 🕚 >>>
UT_ARM_A3_Part_01 🕚 >>>
UT_ARM_A3_Part_02 🕚 >>>
UT_DIST_X86_Part_01 🕚 >>>
UT_DIST_X86_Part_02 🕚 >>>
UT_DIST_X86_Part_03 🕚 >>>
UT_DIST_X86_Part_04 🕚 >>>
UT_inductor_Part_01 🕚 >>>
UT_inductor_Part_02 🕚 >>>
UT_inductor_Part_03 🕚 >>>
UT_inductor_Part_04 🕚 >>>
UT_ARM_A2_Part_01 🕚 >>>
UT_ARM_A2_Part_02 🕚 >>>
流水线 PR-pipeline_pytorch >>>
likedislike
baoxuebin_2026
baoxuebin_2026
4月17日 评论:

compile

likedislike
ascend-robotascend-robot成员
4月17日 删除了label:ci-pipeline-failed
ascend-robotascend-robot成员
4月17日 添加了label:ci-pipeline-running
ascend-robotascend-robot成员
4月17日 删除了label:ci-pipeline-running
ascend-robotascend-robot成员
4月17日 添加了label:ci-pipeline-passed
ascend-robot
ascend-robot成员
4月17日 评论:
流水线 PR-pipeline_pytorch#15891 已完成
阶段 任务名 状态 详情
编译构建 Build_X86 >>>
Build_ARM >>>
Build_LibTorch_x86 >>>
Build_X86_torchair 🛑 >>>
Build_ARM_torchair 🛑 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 CodeCheck >>>
check_error >>>
开源片段检查 SCA >>>
开发者测试 UT_X86_Part_01 🛑 >>>
UT_X86_Part_02 🛑 >>>
UT_ARM_A3_Part_01 🛑 >>>
UT_ARM_A3_Part_02 🛑 >>>
UT_DIST_X86_Part_01 🛑 >>>
UT_DIST_X86_Part_02 🛑 >>>
UT_DIST_X86_Part_03 🛑 >>>
UT_DIST_X86_Part_04 🛑 >>>
UT_inductor_Part_01 🛑 >>>
UT_inductor_Part_02 🛑 >>>
UT_inductor_Part_03 🛑 >>>
UT_inductor_Part_04 🛑 >>>
UT_ARM_A2_Part_01 >>>
UT_ARM_A2_Part_02 >>>
流水线 PR-pipeline_pytorch >>>
likedislike
haiyan8
haiyan8
4月20日 评论:

/lgtm

likedislike
liwei386成员
4月23日 评论:

/approve

likedislike
ascend-robotascend-robot成员
4月23日 添加了label:approvedlgtm
ascend-robot
ascend-robot成员
4月23日 评论:

Review Guide

This pull-request passes review.
Committers who wrote a comment of /approve are: 李伟.
Reviewers who wrote a comment of /lgtm are: 李伟, yuhaiyan.

likedislike
ascend-robotascend-robot成员
4月23日 合入了pull request
baoxuebin_2026baoxuebin_2026
5月21日 修改了pull request 的描述