Merged
docs: add torch.compiler.is_exporting to native api support list #42614
makun-2026Add on Jul 24
docs: add torch.compiler.is_exporting to native api support list #42614
Merged
Pull Request has been successfully merged by ascend-robot.
(Thank you for makun-2026's contribution.)Jul 24 Created pull request, commit 90a1884b
Jul 24 Associated issue: 【社区任务】7月社区任务第二期-Ascend for PyTorch API 一致性开发(96)
ascend-robot
Jul 24 Comments:
Jul 24 Comments:
atomgit-bot
Jul 24 Comments:
Jul 24 Comments:
变更摘要
此 PR 为文档资料更新,将 torch.compiler.is_exporting 补充到 docs/zh/api/native_api 下 5 个版本目录的 torch-compiler.md 原生 API 支持列表中。该 API 已在 NPU 上验证可用,属于非计算类公开 API,各版本统一标记为「是否支持:是」。
主要改动
- 新增
torch.compiler.is_exportingAPI 支持条目:在pytorch_2-7-1、pytorch_2-9-0、pytorch_2-10-0、pytorch_2-11-0、pytorch_2-12-0五个版本目录的torch-compiler.md中,分别新增### torch.compiler.is_exporting章节,包含指向对应版本 PyTorch 原生文档的超链接及「是否支持:是」的标注。 - 补齐历史版本覆盖:此前各版本目录均未收录该 API,本次统一补齐 2.7.1 至 2.12.0 共五个版本的支持声明(2.6/2.8 按说明不刷新)。


Incorrect?
atomgit-bot
Jul 24 Comments:
Jul 24 Comments:
291 messages are collapsed here。 See more
Sep 18 Added label: lgtm
Sep 18 Closed associated issue
Sep 18 Merged pull request
ascend-robot
Sep 18 Comments:
Sep 18 Comments:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


AtlasAccount
Sep 18 Comments:
Sep 18 Comments:
流水线 pytorch_gitcode_PR_multiVersion-onetrack#113 [ commitID:d083e5b0 ] 已完成


【合入来源】
关联 Issue:
【修改方案】
本 PR 在 master 分支的
docs/zh/api/native_api资料树中补充公开 APItorch.compiler.is_exporting的产品支持情况。torch.compiler.is_exporting用于判断当前执行是否处于torch.export追踪上下文,属于公开、非计算类的 Python 状态查询 API,不涉及 Tensor 数据类型支持。本 PR 在以下资料版本中新增
torch.compiler.is_exporting条目:各版本条目包含对应的PyTorch原生文档链接,并按文档统一格式列出产品支持情况:
目标API为非计算类接口,不涉及数据类型支持,因此不新增dtype或
fp32说明。本 PR 仅补充资料,不修改API实现,也不包含测试代码或test_upstreampatch。【资料变更】
补充
torch.compiler.is_exporting在以下资料版本中的产品支持情况:目标API为硬件无关的状态查询接口。其社区用例位置、无需NPU适配分析以及v2.7.1、v2.11.0、v2.12.0原始社区用例验证结果见Issue #4101。上述运行验证不表述为A2、A3、950DT逐硬件实测。
【接口变更】
不涉及。本 PR 不修改API实现,也不新增torch-npu对外接口。
【验证】
静态检查
A5三版本实测
验证环境
Ascend950PR_9579openEuler 24.03 SP3(Linux6.6.0-132.0.0.111.oe2403sp3.x86_64)9.1.03.12.14本次实际设备输出为
Ascend950PR_9579,因此仅按该实际设备型号记录A5验证结果,不表述为已在Ascend 950DT实测。验证方法与口径
torch.compiler.is_exporting不接收Tensor或device参数,也不执行NPU kernel。本次验证分为两部分:执行命令:
python test/export/test_export.py TestExport.test_is_exporting -v该官方用例在
torch.export追踪期间调用torch.compiler.is_exporting(),并检查导出图及torch.cond分支中预期的sin、sub、add和higher_order.cond节点。NPU smoke仅用于证明A5设备环境有效,不作为目标API覆盖;目标API覆盖结论来自上述未修改官方测试。
逐版本结果
2.7.1+cpu2.7.1.post8Ran 1 test in 0.419s、OK、退出码02.11.0+cpu2.11.0Ran 1 test in 2.095s、OK、退出码02.12.0+cu1302.12.0Ran 1 test in 2.039s、OK、退出码0运行截图
完整证据包
2d6a4671deb2ff647b146c68210b6a2448ee8bd8f55a03d8f3012442b82e78f6证据包包含三个版本各自的环境日志、真实NPU smoke完整日志、官方目标测试完整日志、未修改测试源码、源码来源、源码SHA256、目标测试位置及三版本汇总,并已通过
sha256sum -c校验。A5验证结论
在
Ascend950PR_9579 + CANN 9.1.0环境中,v2.7.1、v2.11.0和v2.12.0均完成真实NPU smoke及未修改PyTorch官方目标测试,三个版本均为Ran 1 test、OK、退出码0。v2.13.0未获得匹配环境,未标记为A5运行通过。上述A5结果用于补充实际平台验证证据,不表述为Atlas A2、Atlas A3或Ascend 950DT逐硬件实测。
【CheckList】