[Paddle-Inference]Add MatmulV2ToMatmul convert Pass, fix (matmul_v2, matmul, mul) convert pass, fix (matmul, mul) op_teller #36652
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Others
PR changes
Others
Describe
修改MatmulV2ToMul 的 Pass,重新限定 (matmul_v2 to mul) 映射的 Pass,增加 MatmulV2ToMatmul 的 Pass,限定 (matmul_v2 to matmul) 映射的 Pass条件(不支持广播),修改 (matmul, mul) 的 op_teller 映射条件:
1、 MapMatmulV2ToMatmulPass:原生 op 的映射(matmul_v2 无 scales 的参数,matmul不支持广播);
2、MapMatmul2MulPass、MatmulV2ToMulPass:限制matmul、matmul_v2 映射到 mul 的条件(当 alpha 存在时 ==1、transpose_X==false、transpose_Y==false、y.dims==2、等),移除之前过度的限制(很多无用落后版本的限制,x.dims,后一个 OP 不一定必须是 elementwise_add);
3、修复之前 pass 映射导致的 op 中量化信息(out_threshold)的丢失;
4、增加matmul 的op_teller映射条件:不支持广播的限制;
5、增加mul 的op_teller映射条件:y.dims ==2、y_num_col_dims ==1;
6、动态图量化增加限制:只支持fake_quantize_dequantize_abs_max、fake_channel_wise_quantize_dequantize_abs_max