File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -849,9 +849,19 @@ def apply_dynamic_axes_info(out: onnx.ValueInfoProto, k: str) -> None:
849849
850850 self .log ("ONNX printable graph" , onnx .helper .printable_graph (graph ))
851851
852+ def get_model_opset_imports (graph : onnx .GraphProto ) -> List [onnx .OperatorSetIdProto ]:
853+ opsets = {onnx .defs .ONNX_DOMAIN : self .opset_version }
854+ for node in graph .node :
855+ if node .domain != onnx .defs .ONNX_DOMAIN :
856+ opsets [node .domain ] = 1
857+ opset_imports = []
858+ for domain , version in opsets .items ():
859+ opset_imports .append (onnx .helper .make_opsetid (domain , version ))
860+ return opset_imports
861+
852862 model : onnx .ModelProto = onnx .helper .make_model (
853863 graph ,
854- opset_imports = [ onnx . helper . make_opsetid ( "" , self . opset_version )] ,
864+ opset_imports = get_model_opset_imports ( graph ) ,
855865 producer_name = "pfto" ,
856866 )
857867 model = self .check_model (model )
You can’t perform that action at this time.
0 commit comments