Pull Request has been successfully merged by CANN-robot.
(Thank you for chenfeng's contribution.)变更摘要
本 PR 为 9.1.0 分支的重构改动:将原误落在 ops-nn 仓的 Resize ONNX 框架插件迁移至 ops-cv 仓,新增 common/src/framework/resize_onnx_plugin.cpp(372 行),通过 REGISTER_CUSTOM_OP("PartitionedCall") 注册 ai.onnx::11~18::Resize 与 ai.onnx::10::Resize 两套解析/构图流程,按 nearest/linear/cubic 插值模式分别构图到 ResizeNearestNeighborV2 或 Resize;同时为 9.1.0 分支的 common/stub/inc/framework/stub_ops.h 补充插件构图所需的 Mul、Identity、Shape、Empty、Slice 算子桩定义。插件正文与 ops-nn 原文件逐字一致,仅 include 依赖调整为 cv 仓已具备的 op_cv_proto_extend.h、resize_nearest_neighbor_v2_proto.h 与 onnx_common.h。
主要改动
- 新增
resize_onnx_plugin.cpp并注册两套 Resize 处理流程:通过REGISTER_CUSTOM_OP("PartitionedCall")分别注册ai.onnx::11~18::Resize(ParseParamsResize/ParseOpToGraphResize)与ai.onnx::10::Resize(ParseParamsResizeV10/ParseOpToGraphResizeV10)两条解析与构图链路。 - 按插值模式分别构图到不同算子:
nearest模式经BuildNearestResize/BuildNearestResizeV10构图到ResizeNearestNeighborV2(设置align_corners/half_pixel_centers属性),linear/cubic模式经BuildInterpolatingResize/BuildLinearResizeV10构图到Resize(透传coordinate_transformation_mode/mode属性),并对roi/scales输入缺失时用空Const补齐。 - 新增辅助函数支撑尺寸计算与模式解析:
CreateSliceForResize基于Const+Slice从 sizes 中切取输出尺寸;BuildResizeSizesFromInputs依据输入个数用Shape/Cast/Mul计算目标尺寸;ParseResizeModeAttrs将coordinate_transformation_mode映射为half_pixel_centers/align_corners标志。 - 补充 stub 算子桩定义:在
common/stub/inc/framework/stub_ops.h中新增Mul(逐元素乘法,支持广播与类型提升Promote)、Identity、Shape(含dtype属性)、Empty(含dtype/init属性)、Slice(x/offsets/size三输入)五个算子注册,供迁移后的插件构图使用。 - 移除对 nn 仓头文件的依赖:include 由原 nn 仓头文件调整为 cv 仓的
op_cv_proto_extend.h+resize_nearest_neighbor_v2_proto.h,ChangeFormatFromOnnx直接使用 cv 仓onnx_common.h提供的实现,无需前置声明。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| 9.1.0 | ✅ Andy-lb, 张磊, 刘伟 (3/2) | ✅ Andy-lb (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chenfeng61, thanks for your pull request. All authors of the commits have signed the CLA. 👍


compile


compile


compile


/lgtm


compile


| 🚀 CI 流水线已启动 |
|---|
| 📋 执行详情: 点击查看流水线 |


描述
resize 类算子属视觉算子,其 IR 原型、框架插件等内容应统一归属 ops-cv 仓。此前 Resize 的 ONNX 插件误落在 ops-nn 仓,本 PR 将其迁移至 ops-cv 仓(新增 488 行)。
改动:
common/src/framework/resize_onnx_plugin.cpp:由 ops-nn 迁移而来,通过REGISTER_CUSTOM_OP("PartitionedCall")分别注册ai.onnx::11~18::Resize(含ParseParamsResize/ParseOpToGraphResize)与ai.onnx::10::Resize(含ParseParamsResizeV10/ParseOpToGraphResizeV10)两套处理流程,按nearest/linear/cubic模式分别构图到ResizeNearestNeighborV2或Resize;include 调整为op_cv_proto_extend.h+resize_nearest_neighbor_v2_proto.h(Resize/ResizeNearestNeighborV2 原型 cv 仓已存在),构图逻辑与原文件逐字一致;ChangeFormatFromOnnx已由 cv 仓onnx_common.h提供,无需前置声明。common/stub/inc/framework/stub_ops.h中Mul、Identity、Shape、Empty、Slice算子桩定义:9.1.0 分支 stub 此前仅有 Data/Cast/Const/Concat/Unsqueeze/Transpose,本 PR 补充插件构图所需的Mul/Identity/Shape算子桩及Empty/Slice桩,供插件CreateSliceForResize等函数使用。关联的Issue
https://gitcode.com/cann/ops-cv/issues/827
配套 PR(ops-nn 侧删除,9.1.0 分支):https://gitcode.com/cann/ops-nn/pull/9384
主分支配套 PR:
测试
文档更新
无文档更新。
类型标签