Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenfeng 的贡献)变更摘要
本 PR 将 Resize 的 ONNX 框架插件从 ops-nn 仓迁移至 cv 仓(对应 issue-60 resize 类算子归属清理),并补充插件所需的 Slice 算子桩定义。迁移后插件在 cv 仓内注册 ai.onnx::10~18::Resize 算子,构图逻辑与原文件逐字一致,仅将 include 依赖调整为 cv 仓已有的 op_cv_proto_extend.h、resize_nearest_neighbor_v2_proto.h 及提供 ChangeFormatFromOnnx 的 onnx_common.h,不再需要前置声明。配套地,ops-nn 仓需在单独 PR 中删除重复的 Resize/ResizeNearestNeighborV2 原型及原插件。
主要改动
- 新增
resize_onnx_plugin.cpp插件文件: 新增common/src/framework/resize_onnx_plugin.cpp(+372 行),通过REGISTER_CUSTOM_OP("PartitionedCall")注册ai.onnx::11::Resize至ai.onnx::18::Resize(由ParseParamsResize/ParseOpToGraphResize处理)及ai.onnx::10::Resize(由ParseParamsResizeV10/ParseOpToGraphResizeV10处理),ImplyType均为TVM。 - 按插值模式构建子图:
ParseOpToGraphResize依据mode属性分流——nearest走BuildNearestResize(生成ResizeNearestNeighborV2算子并设置align_corners/half_pixel_centers),linear/cubic走BuildInterpolatingResize(生成Resize算子并透传coordinate_transformation_mode/mode属性),不支持的模式返回FAILED。 - 新增尺寸推导与 Slice 处理: 新增
BuildResizeSizesFromInputs,根据input_size(4 个输入时Cast尺寸,3 个输入时由Shape/Mul/Cast计算目标尺寸);新增CreateSliceForResize通过常量offsets=2、size=2构造op::Slice从 sizes 张量截取切片,供ResizeNearestNeighborV2的 size 输入使用。 - 补充
Slice算子桩定义: 在common/stub/inc/framework/stub_ops.h中新增REG_OP(Slice)桩定义(输入x/offsets/size,输出y,兼容 TensorFlowSlice算子),为插件中的CreateSliceForResize提供编译期依赖,此前 cv 仓无该算子桩。


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 |
|---|---|---|
| repo-cann/ops-cv | ✅ 汤平川, 刘伟 (2/2) | ✅ 汤平川, 刘伟 (2/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


/lgtm
/approve


/lgtm
/approve


描述
resize 类算子属视觉算子,其 IR 原型、框架插件等内容应统一归属 ops-cv 仓。此前 Resize 的 ONNX 插件误落在 ops-nn 仓,本 PR 将其迁移至 ops-cv 仓(新增 394 行)。
改动:
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中Slice算子桩定义:输入x/offsets/size,输出y,兼容 TensorFlow Slice,供插件CreateSliceForResize从 sizes 中切取尺寸使用(cv 仓此前无 Slice 桩)。关联的Issue
https://gitcode.com/cann/ops-cv/issues/827
配套 PR(ops-nn 侧删除):https://gitcode.com/cann/ops-nn/pull/9322
测试
文档更新
无文档更新。
类型标签