File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change 44
55from typing import Sequence
66
7- import onnx
87import onnx_ir as ir
98import onnx_ir .passes .common as common_passes
109
1110
12- def replace_functions (
13- model : onnx .ModelProto , functions : Sequence [onnx .FunctionProto ]
14- ) -> onnx .ModelProto :
11+ def replace_functions (irmodel : ir .Model , irfunctions : Sequence [ir .Function ]) -> None :
1512 """A utility function to replace custom operations in a model with their expansions:
1613 Args:
1714 model: An ONNX ModelProto possibly containing calls to custom operations.
@@ -20,8 +17,6 @@ def replace_functions(
2017 Returns:
2118 An updated ModelProto with custom operations replaced by their expansions.
2219 """
23- irmodel = ir .from_proto (model )
24- irfunctions = [ir .from_proto (func ) for func in functions ]
2520 model_functions = irmodel .functions
2621 if len (model_functions ) != 0 :
2722 # Since we use inlining, check that there are no model-local functions.
@@ -32,4 +27,3 @@ def replace_functions(
3227 # TODO (rama): Ideally, we should provide users more control over renaming strategy for inlined values.
3328 common_passes .InlinePass ()(irmodel )
3429 common_passes .RemoveUnusedOpsetsPass ()(irmodel )
35- return ir .to_proto (irmodel )
You can’t perform that action at this time.
0 commit comments