Pull Request已成功合入, 合并人@CANN-robot
(感谢 Nice try 的贡献)变更摘要
本 PR 为 TensorFlow 算子插件迁移工作("migrate TF plugin part 3")的第三部分,主体思路是:将一批已有算子注册从旧接口 ParseParamsFn(AutoMappingFn) 迁移到新的 ParseParamsByOperatorFn(AutoMappingByOpFn),同时新增多个以自动映射方式注册的 TF 自定义算子,并对部分需要图改写或特殊属性处理的算子提供自定义解析函数(如 ParseOpToGraphFn 图转换、融合解析与类型转换等)。
主要改动
- 注册接口迁移:
bn_infer_tf_plugin.cpp、bn_training_reduce_grad_tf_plugin.cpp、bn_training_update_grad_tf_plugin.cpp、bn_training_update_v2_tf_plugin.cpp、apply_adagrad_tf_plugin.cpp等文件将.ParseParamsFn(AutoMappingFn)替换为.ParseParamsByOperatorFn(AutoMappingByOpFn),并同步将OriginOpType改为std::vector<ge::AscendString>形式。 - 新增自动映射算子注册:新增
RandomStandardNormal、RandomUniformInt、BroadcastGradientArgs、SparseSegmentMean、SparseSegmentMeanGrad、SparseSlice、SparseToDense、Einsum等文件的注册,统一使用AutoMappingByOpFn映射并声明ImplyType::TVM。 - 扩展变体算子覆盖:在既有文件中追加注册以支持同名变体算子,包括
GatherV2文件新增Gather/ResourceGather、ScatterAdd新增TensorScatterAdd、ScatterSub新增TensorScatterSub、BNTrainingUpdateV2新增BNTrainingUpdate、LayerNorm/LayerNormGrad增加FusedLayerNorm/FusedLayerNormGrad对应关系。 - 基于图改写的复合算子映射:新增
GatherPoint(改写为GatherV2加Const轴输入)、GatherPointGrad(改写为ScatterUpdate)及BlockLSTM(改写为DynamicRNN,含Cast序列长度输入与forget_bias/cell_clip/use_peephole属性透传)三个注册,均通过ParseOpToGraphFn构造子图并设置输入输出。 - DynamicRNN 系列注册与融合解析:
dynamic_rnn_tf_plugin.cpp新增DynamicRNN注册并附带FusionParseParamsFn(设置time_major/forget_bias属性及输入HWCN格式);dynamic_rnnv2_tf_plugin.cpp为DynamicRnnV2/DynamicRnnv2WithoutSeqlength设置is_misplaced属性;ascend_weightquant_tf_plugin.cpp将字符串属性dst_type(如"INT4")转换为对应整型数据类型后写回算子。


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 |
|---|---|---|
| common | ✅ 杨阳, 汤平川 (2/2) | ✅ 杨阳 (1/1) |
| index | ✅ 汤平川, 钱泽洪, 杨阳 (3/2) | ✅ 汤平川, 钱泽洪 (2/1) |
| matmul | ✅ 杨阳, 汤平川 (2/2) | ✅ 杨阳 (1/1) |
| norm | ✅ 钱泽洪, 汤平川, 杨阳 (3/2) | ✅ 钱泽洪, 汤平川 (2/1) |
| optim | ✅ 杨阳, 汤平川, 钱泽洪 (3/2) | ✅ 汤平川, 钱泽洪 (2/1) |
| rnn | ✅ 汤平川, 钱泽洪, 杨阳 (3/2) | ✅ 汤平川, 钱泽洪 (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies 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. 👍


/lgtm
/approve


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


描述
将 TF 框架侧自定义算子注册(REGISTER_CUSTOM_OP)从旧工具链迁移至 ops-nn 新仓(TF 插件迁移 part 3),共新增/调整 22 个 *_tf_plugin.cpp 注册文件。
改动原因
改动方法
按模块汇总:
关联的Issue
关联 Issue #5505:https://gitcode.com/cann/ops-nn/issues/5505
测试
本 PR 仅涉及注册/图解析代码迁移,无测试文件变更;依赖仓内 CI(编译、静态检查、UT/ST 工作流)验证。
文档更新
无。
类型标签
AI/Agent生成声明