已合并
feat: 新增16个算子的TensorFlow插件注册 #9643
Nice try创建于 20 天前
feat: 新增16个算子的TensorFlow插件注册 #9643
已合并
Nice try创建于 20 天前
Nice try
Nice try成员
20 天前

描述

本次变更为 16 个算子新增 TensorFlow 框架插件注册(*_tf_plugin.cpp),使这些算子在 TensorFlow 图解析时可通过 REGISTER_CUSTOM_OP 自动映射到昇腾算子(AutoMappingByOpFnImplyType::TVM),注册模式与仓库内已有 *_tf_plugin.cpp 文件保持一致。

新增注册的算子(16 个):

算子 注册文件
PReluGrad activation/p_relu_grad_update/framework/prelu_grad_tf_plugin.cpp
Centralization common/src/framework/centralization_tf_plugin.cpp
DynamicAUGRUGrad common/src/framework/dynamic_augru_grad_tf_plugin.cpp
DynamicAUGRU common/src/framework/dynamic_augru_tf_plugin.cpp
DynamicGRUV2Grad common/src/framework/dynamic_gruv2_grad_tf_plugin.cpp
DynamicGRUV2 common/src/framework/dynamic_gruv2_tf_plugin.cpp
DynamicRNNGrad common/src/framework/dynamic_rnn_grad_tf_plugin.cpp
LRNGrad common/src/framework/lrn_grad_tf_plugin.cpp
LRN common/src/framework/lrn_tf_plugin.cpp
LRUCacheV2 common/src/framework/lru_cache_v2_tf_plugin.cpp
MaxPoolGradGrad common/src/framework/max_pool_grad_grad_tf_plugin.cpp
BNInferGrad norm/bn_infer_grad/framework/bn_infer_grad_tf_plugin.cpp
MaxPoolGradGradWithArgmax pooling/max_pool_grad_grad_with_argmax/framework/max_pool_grad_grad_with_argmax_tf_plugin.cpp
MaxPoolV2 pooling/max_pool_v2/framework/max_pool_v2_tf_plugin.cpp
MaxPool pooling/max_pool_v3/framework/max_pool_v3_tf_plugin.cpp
Dequantize quant/dequantize/framework/dequantize_tf_plugin.cpp

关联的Issue

测试

本次改动仅为算子注册文件(编译期注册),未包含测试用例。

文档更新

无。

类型标签

AI/Agent生成声明

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 Nice try 的贡献)
Nice tryNice try成员
20 天前 创建了 pull request,commit ae659e9b
atomgit-bot
atomgit-bot
20 天前 评论:

变更摘要

本 PR 旨在将一批算子的 TensorFlow 框架插件注册迁移/新增到框架层(标题 "migrate TF plugin")。改动全部为新增源码文件,共 16 个 *_tf_plugin.cpp,每个文件在 domi 命名空间下通过 REGISTER_CUSTOM_OP 注册一个自定义算子,统一指定 .FrameworkType(TENSORFLOW).OriginOpType(...).ParseParamsByOperatorFn(AutoMappingByOpFn).ImplyType(ImplyType::TVM),使 GE 能够识别并映射 TensorFlow 图中的对应算子。

主要改动

  • 新增激活类算子 TF 插件:新增 prelu_grad_tf_plugin.cpp,注册 PReluGrad,实现 PRelu 梯度算子在 TensorFlow 框架下的算子映射。
  • 新增 RNN/GRU 系列算子 TF 插件:新增 dynamic_augru_tf_plugin.cppdynamic_augru_grad_tf_plugin.cppdynamic_gruv2_tf_plugin.cppdynamic_gruv2_grad_tf_plugin.cppdynamic_rnn_grad_tf_plugin.cpp,分别注册 DynamicAUGRUDynamicAUGRUGradDynamicGRUV2DynamicGRUV2GradDynamicRNNGrad 等动态时序算子。
  • 新增归一化/池化/量化类算子 TF 插件:新增 lrn_tf_plugin.cpplrn_grad_tf_plugin.cppbn_infer_grad_tf_plugin.cppmax_pool_v2_tf_plugin.cppmax_pool_v3_tf_plugin.cppmax_pool_grad_grad_tf_plugin.cppmax_pool_grad_grad_with_argmax_tf_plugin.cppdequantize_tf_plugin.cpp,分别注册 LRNLRNGradBNInferGradMaxPoolV2MaxPoolMaxPoolGradGradMaxPoolGradGradWithArgmaxDequantize
  • 新增缓存与中心化算子 TF 插件:新增 lru_cache_v2_tf_plugin.cppcentralization_tf_plugin.cpp,注册 LRUCacheV2Centralization,其中 LRUCacheV2 注释明确为向 GE 注册该算子。
  • 统一注册方式:所有新增插件均采用 AutoMappingByOpFn 自动参数映射并指定 ImplyType::TVM,确保算子解析与实现类型配置一致,从而支持 TensorFlow 模型到 GE 的对接。
likedislike
不准确?
atomgit-bot
atomgit-bot
20 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
20 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
20 天前 评论:

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
activation 钱泽洪, 陈兴宇 (2/2) 陈兴宇, 钱泽洪 (2/1)
common 刘波, 商晓波 (2/2) 刘波 (1/1)
norm 陈兴宇, 钱泽洪 (2/2) 陈兴宇, 钱泽洪 (2/1)
pooling 钱泽洪, 陈兴宇 (2/2) 陈兴宇, 钱泽洪 (2/1)
quant 钱泽洪, 商晓波 (2/2) 钱泽洪 (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

Nice_try, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robot成员
20 天前 将zengjuan,sxb154714,chenfeng61,chaotang233,kevin_huang1234,crystalhu,yangyang016,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,chenqi317,LinPX,wang-xing001,liubo75,tangweiwei2,wangzitao_leo,xubinglin,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong,liuyang_806,liuchuangdev设为评审人
CANN-robotCANN-robot成员
20 天前 将sxb154714,chenfeng61,kevin_huang1234,crystalhu,yangyang016,fanqirui,wangrui_,renruhai,su-yueming,zhajianqing123,chenqi317,LinPX,wang-xing001,liubo75,tangweiwei2,wangzitao_leo,xubinglin,chenxingyu18,liujie12345678,pingchuantang,Chen_HaoWen,qianzehong,liuyang_806,liuchuangdev设为审查人
Nice tryNice try成员
20 天前 修改标题为 “feat: 新增16个算子的TensorFlow插件注册”,原标题为“migrate TF plugin”
Nice tryNice try成员
20 天前 修改了pull request 的描述
yuning_chen
yuning_chen成员
20 天前 评论:

您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!

likedislike
Nice try
Nice try成员
20 天前 评论:

compile

likedislike
Nice tryNice try成员
20 天前 预合并成功(commit_id: 8c8ea2c143c6550c9ec1c0d33384ab47145ecea1)
CANN-robotCANN-robot成员
20 天前 添加了label:ci-pipeline-running
songkai111成员
20 天前 评论:

/approve

likedislike
CANN-robot
CANN-robot成员
20 天前 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
宋恺

likedislike
CANN-robotCANN-robot成员
20 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
20 天前 添加了label:ci-pipeline-passed
yuning_chen
yuning_chen成员
20 天前 评论:

您好,pr合入已准备就绪,请尽快联系committer进行检视,谢谢!

likedislike
qianzehong成员
19 天前 评论:

/approve

likedislike
CANN-robot
CANN-robot成员
19 天前 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
宋恺

likedislike
chenxingyu18成员
19 天前 评论:

/approve

likedislike
CANN-robot
CANN-robot成员
19 天前 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
宋恺

likedislike
liubo75成员
19 天前 评论:

/approve

likedislike
CANN-robot
CANN-robot成员
19 天前 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
宋恺

likedislike
CANN-robotCANN-robot成员
19 天前 添加了label:approved
sxb154714
sxb154714成员
19 天前 评论:

/lgtm

likedislike
CANN-robot
CANN-robot成员
19 天前 评论:

The following users do not have permission to comment /lgtm or /approve on any module in this PR:
宋恺

likedislike
CANN-robotCANN-robot成员
19 天前 添加了label:lgtm
CANN-robotCANN-robot成员
19 天前 关闭了关联的issue
CANN-robotCANN-robot成员
19 天前 合入了pull request