已开启
docs: Add torch.onnx.ONNXProgram.optimize to native_api documentation #43671
docs: Add torch.onnx.ONNXProgram.optimize to native_api documentation #43671
已开启
木路折创建于 8月4日
木路折
木路折
8月4日

【合入来源】

【修改方案】

在 master 资料中为公开 API torch.onnx.ONNXProgram.optimize 补齐支持情况。已覆盖 2-7-1/2-11-0/2-12-0/2-13-0 四个版本目录,2-9-0/2-10-0 已删除不涉及,符号按最新格式使用 ✔/✘”

修改文件:

docs/zh/api/native_api/pytorch_2-7-1/torch-onnx.md
docs/zh/api/native_api/pytorch_2-11-0/torch-onnx.md
docs/zh/api/native_api/pytorch_2-12-0/torch-onnx.md
docs/zh/api/native_api/pytorch_2-13-0/torch-onnx.md

【资料变更】

资料检查结果:此前 master 下各版本的 torch-onnx.md 未收录 ONNXProgram.optimize()
ONNXProgram 类本身及 model_proto()save() 方法均已收录。
optimize() 为非计算类 API,实际已支持,故需要补充。

本次在以下版本目录的 torch-onnx.md 中新增支持情况:

PyTorch 2.7.1
PyTorch 2.11.0
PyTorch 2.12.0
PyTorch 2.13.0

【接口变更】

不涉及

仅补充文档,未修改任何业务代码。

【功能介绍】

torch.onnx.ONNXProgram.optimize() 是 ONNXProgram 类的公开方法,用于优化 ONNX 模型。
该方法通过常量折叠和冗余消除优化 ONNX IR 图,原地生效,返回值为 None。
为非计算类 API,与数据类型和设备无关。

【功能验证】

接口测试由以下 PR 覆盖:

【CheckList】

likedislike
合并受阻
木路折木路折
8月4日 创建了 pull request,commit 12cfe26a
木路折木路折
8月4日 关联了issue:【社区任务】7月社区任务第四期-Ascend for PyTorch API 一致性开发(11)
atomgit-bot
atomgit-bot
8月4日 评论:

变更摘要

本次 PR 为 torch.onnx.ONNXProgram.optimize 在四份 PyTorch 版本对应的 native_api 文档中补齐了支持情况说明。ONNXProgram.optimize() 是 ONNXProgram 类的公开方法,用于通过常量折叠和冗余消除优化 ONNX IR 图,此前各版本文档中该类仅收录了 model_proto()save() 方法,optimize() 缺失。此次变更仅涉及文档更新,未修改任何业务代码。

主要改动

  • 在多版本文档中新增 optimize() 支持情况:在 docs/zh/api/native_api/pytorch_2-7-1/torch-onnx.mdpytorch_2-11-0/torch-onnx.mdpytorch_2-12-0/torch-onnx.mdpytorch_2-13-0/torch-onnx.md 四个文件中的 ONNXProgram.save() 条目之后,统一插入 torch.onnx.ONNXProgram.optimize 的支持情况描述,标注为"支持,暂不支持 Ascend 950DT"。
  • 统一四个版本目录的文档结构:以相同的描述内容和插入位置在 PyTorch 2.7.1、2.11.0、2.12.0、2.13.0 四个版本目录下完成一致性更新,共新增 64 行文档内容。
likedislike
atomgit-bot
atomgit-bot
8月4日 评论:

代码审查

✅ 未发现问题

likedislike
此处折叠了179条消息 查看更多
ascend-robotascend-robot成员
6 天前 删除了label:docs-ci-pipeline-running
ascend-robotascend-robot成员
6 天前 添加了label:docs-ci-pipeline-success
AtlasAccountAtlasAccount成员
6 天前 删除了label:ci-pipeline-running
AtlasAccountAtlasAccount成员
6 天前 添加了label:ci-pipeline-passed
AtlasAccount
AtlasAccount成员
6 天前 评论:
流水线 PR-pipeline_pytorch#64881 [ commitID:f884ede3 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build_X86 🛑 >>>
Build_ARM 🛑 >>>
Build_X86_torchair 🛑 >>>
Build_ARM_torchair 🛑 >>>
patch_test 🛑 >>>
Build_X86_213 🛑 >>>
Build_ARM_213 🛑 >>>
恶意代码检查 Antipoison >>>
编码安全与规范检查 codecheck_pre-commit >>>
check_error >>>
lintrunner >>>
开源片段检查 SCA >>>
开发者测试 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 🛑 >>>
UT_ARM_A2_Part_213 🛑 >>>
UT_inductor_Part_213 🛑 >>>
UT_DIST_ARM_Part_213 🛑 >>>
UT_ARM_A2_Select_Part_213 🛑 >>>
流水线 PR-pipeline_pytorch >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[wujinyuan1, huangjingwei, liangsongwei, yashi999, culechan, Dring, wuyouqi1, L1919_snow, qq_52711437, WhiteNight12, nomiz, xiu_21, ffmh, wanglijun55, hss-shuai, husichao, smallsilly, lanshaozuishuai, jimmyisme1, lzy0920232, alpha-junh, Sunshine_Youngster, wei_zhuoyi, zhangyihuiben, zyw-hw, zzzkeke, rmch, yangch0324, LucciC, AACAES, renyujin, wjlflyer, senzhen-town, pengjingyou, qsc97, limuan, yule100, xiaoqi-zhou, kuhn7, chenxingying, hanye02, zichun_ye, anyrenwei, kkjocker, wangzili121, Lu_G, yvjc, puddingfjz, HandsoemLemon, bigprestigee1, huawuyi, zhenyu10, dairenjie, du-jin-hang, zou-jieyu, adelaideliu, TrHan, wanlinan, Windwindzzz, pengqihw, kisnwang, yuheng_wang, honghao_wang, jizewei, zhangguoguang, sunyu-xuan, chenrayray, hbhu_bin, liujunzhu, c_34, LiNuoh, maoyuanpeng1, zzhongmin, zhaoyu65, bellatan, jiabaolin, zhuofanshen, wencaiwen, lu_zhuge, caoshuyang, molly12, lyx324521, LQ1206, gitcode-chenjiao, cai-weiwei1989, CHDong, ogqin, yuanlipingGit, xuqinglin1, lqz2, zouwei1, chaoluoa, paradox325, jackzhang1116, yaoyao, akh, yujiacheng, dengjie0116, Hubert11111, Shine_Ws, wslhj555, longqiand, OYtao666, JiaqingQiang, luyyyy, Kingbelial, zhanghaiyu0101, wenxp1018, yanliu-luoluo, ksun_sekiro, liyong328, wgzheng, tangky, vivi_is_coding, aoiaoisola, weixin_44494597, wangmengmengwang65667, hid57809721, qq_35468730, comeonup, C547032, gcw_m5OQChA4, yao_yao_ling_xian, cnnbwcy, szqfes_12, cora_19, cann_lilin, can, shawnylee233, fanglanyue0916, hhz0, LiNuohang, taohuoquan, Jesse, WSs_321, SCh_zx]评论有效
  • compile、compile_inductor、compile_torchair : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike