File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
onnxscript/function_libs/torch_lib Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 1717from typing_extensions import TypeAlias
1818
1919import onnxscript
20+
21+ # Q: Don't know why vscode only recognizes this import style instead of `from onnxscript import optimizer`.
22+ import onnxscript .optimizer as optimizer
2023from onnxscript import evaluator
2124from onnxscript import tensor as onnxscript_tensor
2225from onnxscript ._internal import param_manipulation , runtime_typing
2326from onnxscript .function_libs .torch_lib import _flags
2427from onnxscript .function_libs .torch_lib .ops import common as common_ops
28+ from onnxscript .rewriter import onnxruntime as ort_rewriter
2529
2630__all__ = [
2731 "TorchScriptTensor" ,
@@ -1073,4 +1077,9 @@ def to_model_proto(
10731077 common_ops .common_opset .domain , common_ops .common_opset .version
10741078 )
10751079 )
1080+
1081+ # Not the best integration point. Enables benchmarking the migration.
1082+ onnx_model = optimizer .optimize (onnx_model )
1083+ # This also creates contrib op in the model. So definitely not the best integration point.
1084+ onnx_model = ort_rewriter .rewrite (onnx_model )
10761085 return onnx_model
You can’t perform that action at this time.
0 commit comments