PermuteFusionPass

Fusion Pattern

This fusion replaces the Permute operator in the graph with the TransposeD or Transpose operator. The replacement method depends on the running platform:

Use case 1:

Permute is replaced with the TransposeD operator. The dimension permutation attribute of Permute is passed as the perm attribute of TransposeD. The supported platforms are as follows:

Atlas A3 products

Atlas A2 products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

The graph structures before and after fusion are as follows:

Use case 2:

Replace Permute with the Transpose operator. The dimension permutation attribute of Permute is passed as a Const node to the perm input of Transpose. Supported products are as follows:

Ascend 950PR&950DT products

The graph structures before and after fusion are as follows:

The dimension permutation order of the Permute operator is preferentially read from the perm attribute. If the attribute does not exist, the order attribute is read. The shape and dtype of the output after replacement are the same as those of the original Permute output.

Constraints

  • Structural constraints:
    • The graph contains a Permute operator, with input x and output y.
    • The Permute operator must carry the perm or order attribute to specify the dimension permutation order. The attribute value must be a valid full permutation of the dimensions of x, without repetition or omission.
  • Version constraint: The fusion takes effect when the GE compiler version is 9.1.0 or later.

Applicable Products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Atlas A2 products

Atlas A3 products

Ascend 950PR&950DT products