Analysis Example of UB Operator Fusion Recommendation
Background
An operator is the basic unit of a model. During model conversion, operators are fused to improve network performance. If a model contains operators that are not covered by existing fusion patterns but can be fused, the optimal performance cannot be achieved after model conversion. This section uses the YOLOv5 model as an example to describe how to use UB operator fusion recommendation of MindStudio Advisor to automatically and quickly discover and output Cube and Vector operators that can be fused in a model, helping users improve model performance.
- This document describes only the operation and analysis process of UB operator fusion recommendation of Advisor. Specific operations of operator fusion in the OM model are not described here.
- For details about UB operator fusion, see the Graph Fusion and UB Fusion Patterns.
- For details about model conversion, see the Model Conversion.
MindStudio Advisor Operations
- Prepare the offline OM model file generated after model conversion as the input file of UB operator fusion recommendation.
The offline OM model file is stored in the project directory in the root path of the ${data_path} data directory.
- Open a built application project.
- Choose on the menu bar. The MindStudio Advisor page is displayed. See Figure 1.
- Click New Project
in the upper left corner of the Figure 1. The Advisor system configuration page is displayed. - Set related parameters according to Figure 2 and click Start.
- After the analysis is complete, the system displays the analysis result. The following figure shows the output operators that can be fused in the YOLOv5 model.
Fault Analysis
Figure 3 shows the types and names of operators that can be fused. Click See More to view the positions and details of the operators that can be fused in the model, as shown in Figure 4.
Troubleshooting
For specific fusion operations, developers need to modify the operator code. Figure 5 shows an example of the model structure after fusion.
In the preceding figure, the Conv2D, Mul, and AscendQuart operators of the YOLOv5 network model are fused into the Conv2D operator. The left part shows the structure of the YOLOv5 network model before fusion, and the right part shows the tuned YOLOv5 network model structure. The structure of the tuned model is simplified.
Conclusion
After using MindStudio Advisor to analyze UB operator fusion of an OM model, we found that MindStudio Advisor can quickly and accurately locate operators that can be fused in the OM model, reducing the locating time and improving the efficiency.




