已合并
refactor: 删除 nn 仓重复的 resize 类算子 IR 原型与 ONNX 插件 #9322
refactor: 删除 nn 仓重复的 resize 类算子 IR 原型与 ONNX 插件 #9322
已合并
chenfeng创建于 8月27日
chenfeng
chenfeng成员
8月27日

描述

resize 类算子(ResizeNearestNeighborV2、Resize)属视觉算子,其 IR 原型与 ONNX 框架插件应统一归属 ops-cv 仓。此前这两段 REG_OP 定义在 ops-nn 仓与 ops-cv 仓重复存在,且 resize_onnx_plugin.cpp 的 ONNX 插件误落在 ops-nn 仓。

本 PR 在 nn 侧执行删除(新增 0 行、删除 479 行):

  • 删除 common/inc/op_graph/op_nn_proto_extend.h 中 ResizeNearestNeighborV2、Resize 两段 REG_OP 定义(含 align_corners、half_pixel_centers、scales、coordinate_transformation_mode、mode、nearest_mode 等属性与输入输出类型定义),这些定义与 ops-cv 仓已有定义重复,统一由 ops-cv 仓承接;
  • 删除 common/src/framework/resize_onnx_plugin.cpp 整个文件,包括 ParseParamsResize/ParseOpToGraphResize、ParseParamsResizeV10/ParseOpToGraphResizeV10 等解析与构图逻辑,以及基于 REGISTER_CUSTOM_OP("PartitionedCall") 对 ai.onnx::10~18::Resize 的插件注册(nearest/linear/cubic 插值路径),该插件已迁移至 ops-cv 仓。

删除后 op_nn_proto_extend.h 中 MatMulV2 与 IndexByTensor 定义衔接保持正确,花括号平衡。

关联的Issue

https://gitcode.com/cann/ops-nn/issues/5238

配套 PR(ops-cv 侧迁入):https://gitcode.com/cann/ops-cv/pull/1406

测试

  • pre-commit 全部通过(clang-format / OAT / codespell 等)
  • 删除后 op_nn_proto_extend.h 结构完整性验证:MatMulV2 与 IndexByTensor 衔接正确

文档更新

无文档更新。

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 chenfeng 的贡献)
chenfengchenfeng成员
8月27日 创建了 pull request,commit bc0efa51
chenfengchenfeng成员
8月27日 关联了issue:CVE-2024-24786
atomgit-bot
atomgit-bot
8月27日 评论:

变更摘要

本 PR 为 issue-60 resize 类算子归属清理的配套改动(cherry-pick 自 cann/ops-nn#9236)。由于 ResizeNearestNeighborV2、Resize 的 IR 原型在 ops-cv 仓已存在且定义一致,Resize 的 ONNX 插件也已迁入 ops-cv 仓,因此本 PR 删除 nn 仓中重复的算子定义与插件实现,共删除 479 行代码,无新增内容。

主要改动

  • 删除 ResizeNearestNeighborV2 算子 IR 定义:移除 common/inc/op_graph/op_nn_proto_extend.h 中 ResizeNearestNeighborV2 的 REG_OP 定义(含 x/size 输入、y 输出及 align_corners、half_pixel_centers、scales 属性),该算子定义在 ops-cv 仓已有重复且一致的定义。
  • 删除 Resize 算子 IR 定义:移除同文件中 Resize 的 REG_OP 定义及其 OPS_PROTO_DEF_RESIZE 宏保护段,包括 x/roi/scales/sizes 输入、y 输出及 coordinate_transformation_mode、mode、nearest_mode 等属性。
  • 删除 Resize ONNX 插件实现:删除 common/src/framework/resize_onnx_plugin.cpp 整个文件,包括 ParseParamsResize、ParseOpToGraphResize、BuildNearestResize、BuildInterpolatingResize、BuildResizeSizesFromInputs 等解析与构图函数,以及针对 ai.onnx::10::Resize 至 ai.onnx::18::Resize 的 REGISTER_CUSTOM_OP("PartitionedCall") 注册逻辑;该插件已迁移至 ops-cv 仓。
  • 保持 op_nn_proto_extend.h 结构完整:删除后保留文件花括号平衡,MatMulV2 与 IndexByTensor 的算子定义衔接正确,pre-commit(clang-format / OAT / codespell)全部通过。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月27日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
8月27日 添加了label:cann-cla/yes
此处折叠了42条消息 查看更多
CANN-robotCANN-robot成员
8月28日 合入了pull request
chenfengchenfeng成员
8月29日 删除了关联的issue:[Bug-Report|缺陷反馈]: foreach目录下存在资源泄露问题
chenfengchenfeng成员
8月29日 关联了issue:[缺陷反馈]: Resize不属于nn仓内容,应删除
chenfengchenfeng成员
8月29日 修改了pull request 的描述
chenfengchenfeng成员
8月31日 修改了pull request 的描述