已关闭
[Requirement|需求建议]: 迁移 TF 算子注册/分解插件至 ops-nn 新工具链(part 3) #5505
Nice try创建于  3 天前关闭于  2 天前
Nice try
Nice try成员
3 天前 创建

Thanks for sending an requirement! Please fill in the following template to help quickly solve your problem.

Backgroud(背景信息)

CANN ops 仓重组为 ops-nn/ops-math 等新仓后,TF 框架侧的算子注册(REGISTER_CUSTOM_OP)需要迁移到新仓工具链。旧注册 API(ParseParamsFn/AutoMappingFn、标量 OriginOpType)以及依赖 TF protobuf NodeDef(node_def.pb.h)的解析逻辑在新工具链中已不存在,需统一迁移为 ParseParamsByOperatorFn(AutoMappingByOpFn)、OriginOpType(std::vectorge::AscendString{...}),复杂算子改为基于 ge::Operator 的子图分解(ParseOpToGraphFn / FusionParseParamsFn)。本需求为 TF 插件迁移系列的第三部分,补齐 common/index/norm/optim/matmul/rnn 各模块剩余算子的 TF 注册与解析。

Origin(信息来源)

cann/ops-nn 仓 TF 插件迁移工程(本仓已完成迁移 part 1/2 的同系列工作)。

Benefit / Necessity (价值/作用)

补齐 TF 框架侧算子在 ops-nn 新工具链的注册与图解析/分解能力,覆盖:Gather/ResourceGather、TensorScatterAdd/TensorScatterSub、FusedLayerNorm/FusedLayerNormGrad、BroadcastGradientArgs、SparseSegmentMean/SparseSegmentMeanGrad、SparseSlice、SparseToDense、Einsum、AscendWeightQuant、BNTrainingUpdate、GatherPoint/GatherPointGrad、BlockLSTM、DynamicRNN/DynamicRnn、DynamicRNNV2/DynamicRnnV2 系列、ApplyAdagrad 等,保证携带上述算子的 TF 模型可正常解析落图运行。

Design(设计方案)

按模块将注册迁移拆分为四组:

  • 纯注册迁移:既有 *_tf_plugin.cpp 由 ParseParamsFn(AutoMappingFn) 迁移到 ParseParamsByOperatorFn(AutoMappingByOpFn),多 origin 由标量列表改为 OriginOpType(std::vectorge::AscendString{...});
  • 新增同名映射:Gather(Gather/ResourceGather)、TensorScatterAdd/TensorScatterSub、FusedLayerNorm 系列、BNTrainingUpdate、DynamicRnn 等在同一 op 目录下以独立 REGISTER_CUSTOM_OP 块补充;
  • 子图分解:GatherPoint 分解为 GatherV2+Const(axis) 子图,GatherPointGrad 分解为 ScatterUpdate 子图,BlockLSTM 分解为 DynamicRNN 子图(seq_length 经 Cast、cell_type=BLOCKLSTM、输出重排 {3,2,5,6,4,7,1});
  • 融合解析:DynamicRNN 注册 FusionParseParamsFn,解析输入 format(FORMAT_HWCN)与 time_major/forget_bias 等属性;DynamicRNNV2/DynamicRnnV2 系列注册带 is_misplaced 属性处理。
    全部为 *_tf_plugin.cpp 注册文件变更(24 个文件,+627/-8),不涉及 kernel/tiling 与测试文件。

关联 PR:https://gitcode.com/cann/ops-nn/pull/9758

likedislike
Nice tryNice try成员
3 天前 添加了label:requirement
Nice try
Nice try成员
3 天前 评论:

/assign @Nice_try

likedislike
CANN-robotCANN-robot成员
3 天前 将 Nice_try 设为负责人
Nice tryNice try成员
2 天前 修改了issue 的描述
CANN-robotCANN-robot成员
2 天前 关闭了 issue
CANN-robotCANN-robot成员
2 天前 添加了label:resolved