BatchMatMulV2ReduceFusionPass

Description

Fuses the BatchMatMulV2+Reduce operators into the BatchMatMulV2 operator.

Mode 1:

Before: After:

Mode 2:

Before: After:

Restrictions

  • The left and right matrices of BatchMatMulV2 are 3-dimensional and the batch axis is greater than 1.
  • Nodes in graph fusion are static.
  • The construction graph must be either BatchMatMulV2-->Cast32-->ReduceSumD-->Output or BatchMatMulV2-->ReduceSumD-->Output.
  • If the node after BatchMatMulV2 is Cast32, the output data type is fp16, and the output data type of Cast is fp32.
  • BatchMatMulV2 must have two input nodes and one output node.