昇腾社区首页
中文
注册

TbeFullyconnectionElemwiseDequantFusionPass

融合模式

该融合将满足如下Pattern关系的子图中FullyConnection / MatMul / MatMulV2 / BatchMatMul / BatchMatMulV2 + ElemWise + AscendQuant + AscendDequant对应节点进行UB融合。

第5个Pattern中的虚线框代表这些节点可以没有匹配。

使用约束

1. ElemWise2节点仅支持 : Elu, LeakyRelu, Gelu, Softsign, Relu6, Relu, Softplus, Sigmoid, Tanh, Selu, GeluGrad, Add, AddN, FastGelu, FastGeluV2, FastGeluGrad, Eltwise, PRelu, Mul, Muls, Power, Relu6D, TanhGrad

2. 不支持动态shape场景

3. matmul/dequant/gelu/quant场景下,ElemWise1节点必须是Gelu, 数据类型仅支持fp32

4. ElemWise2不为空时, ElemWise1必须是Relu, LeakyRelu, Add, Muls, AddN, ElemWise2必须为Relu6

4.1 ElemWise1为Add时, Add 输入node必须为2, 输出node为1,且之前的节点为FullyConnection

4.2 ElemWise1为LeakyRelu, 需要有negative_slope,negative_slope绝对值要大于1.19209e-07

5. 不支持MatMul + ElemWise1为AddN或者Mul

6. BatchMatMul / BatchMatMulV2场景下不支持ElemWise2为Add或Relu

7. 当 elemwise_node type 为 add 时,fc 的输出形状不能小于 add 的输入形状

支持的型号

Atlas 200/300/500 推理产品

Atlas 200I/500 A2 推理产品

Atlas 推理系列产品

Atlas 训练系列产品