Optimizing a Model using the Optimizer¶
Introduction¶
The ONNX Script Optimizer
tool provides the user with the functionality to optimize an ONNX model by performing optimizations and clean-ups such as constant folding, dead code elimination, etc.
Usage¶
In order to utilize the optimizer tool,
import onnxscript
onnxscript.optimizer.optimize(model)
optimize API¶
The onnxscript.optimizer.optimize
call takes in several optional parameters that allows the caller to further fine-tune the process of optimization.
Description of optimizations applied by onnxscript.optimizer.optimize
¶
Optimization ‘onnxscript.optimizer.` + … |
Description |
---|---|
Constant folding |
Applies constant folding optimization to the model. |
Constant propagation |
Applies constant propagation optimization to the model. Applied as part of the constant folding optimization. |
Sequence simplification |
Simplifies Sequence based ops (SequenceConstruct, ConcatFromSequence) present in the model. Applied as part of the constant folding optimization. |
Remove unused nodes |
Removes unused nodes from the model. |
Remove unused functions |
Removes unused function protos from the model. |
Inline functions with unused outputs |
Inlines function nodes that have unused outputs. |
Inline simple functions |
Inlines simple functions based on a node count threshold. |
List of pattern rewrite rules applied by onnxscript.optimizer.optimize
¶
|
|
|
|
|
|
|