已合并
docs: Add torch.onnx.ONNXProgram.optimize to native_api documentation #43671
木路折创建于 8月4日
docs: Add torch.onnx.ONNXProgram.optimize to native_api documentation #43671
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 木路折 的贡献)8月4日 关联了issue:【社区任务】7月社区任务第四期-Ascend for PyTorch API 一致性开发(11)
atomgit-bot
8月4日 评论:
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.md、pytorch_2-11-0/torch-onnx.md、pytorch_2-12-0/torch-onnx.md、pytorch_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 行文档内容。


不准确?
ascend-robot
8月4日 评论:
8月4日 评论:
atomgit-bot
8月4日 评论:
8月4日 评论:
此处折叠了429条消息 查看更多
ascend-robot
1 天前 评论:
1 天前 评论:
✅ 跳过 docs ci 检查,没有需要检查的文档文件


1 天前 删除了label:docs-ci-pipeline-running
1 天前 添加了label:docs-ci-pipeline-success
ascend-robot
1 天前 评论:
1 天前 评论:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


AtlasAccount
1 天前 评论:
1 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion-onetrack#419 [ commitID:35be5bfa ] 已完成


【合入来源】
需求
问题单
issue/工单 https://gitcode.com/Ascend/pytorch/issues/3490
重构优化
资料更新
【修改方案】
torch.onnx.ONNXProgram.optimize在 PyTorch 官方文档中已有收录,非私有接口。该 API 在 NPU 上已支持,但 Ascend 文档中未收录,需要补充资料。该 API 为非计算类接口,与数据类型无关,支持情况直接使用列表格式表示。
【资料变更】
docs/zh/api/native_api 中 7 个版本目录补充
torch.onnx.ONNXProgram.optimize的文档:每个文件在
ONNXProgram.save()条目之后新增optimize()条目,格式按照最新规范使用列表格式(产品支持情况),原生文档链接使用 docs.pytorch.org 域名。A2 支持,A3 支持,Ascend 950DT 支持(经 A5 服务器验证通过)。【接口变更】
不涉及
仅修改文档资料,未修改任何业务代码。
【功能验证】
验证场景:
ONNXProgram.optimize()返回值、模型有效性、幂等性、IO 数量保持共 4 个测试。验证方法:在 A2/A3 和 A5 (Ascend 950) 服务器上分别运行测试用例,4 个测试全部 PASSED。
A2 验证
运行命令:
TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest test/onnx/exporter/test_onnx_program.py -vA3 验证
运行命令:
TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest test/onnx/exporter/test_onnx_program.py -vA5 (Ascend 950) 验证
运行命令:
TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest test/onnx/exporter/test_onnx_program.py -v【CheckList】