File tree Expand file tree Collapse file tree
tools/onnx-graphsurgeon/onnx_graphsurgeon/ir Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -703,6 +703,7 @@ def fold_constants(
703703 size_threshold = None ,
704704 should_exclude_node = None ,
705705 recurse_functions = True ,
706+ ort_session_options = None ,
706707 ):
707708 """
708709 Folds constants in-place in the graph. The graph's nodes and functions must be topologically
@@ -758,7 +759,8 @@ def fold_constants(
758759 recurse_functions (bool):
759760 Whether to fold constants in this graph's Functions.
760761 Defaults to True.
761-
762+ ort_session_options (Optional[onnxruntime.SessionOptions]):
763+ SessionOptions object to be used for ONNX Runtime sessions.
762764 Returns:
763765 self
764766 """
@@ -1176,6 +1178,7 @@ def get_out_node_ids():
11761178
11771179 sess = onnxrt .InferenceSession (
11781180 export_onnx (part , do_type_check = False ).SerializeToString (),
1181+ sess_options = ort_session_options ,
11791182 providers = ORT_PROVIDERS ,
11801183 )
11811184 values = sess .run (names , {})
@@ -1258,6 +1261,7 @@ def should_eval_foldable(tensor):
12581261 export_onnx (
12591262 graph_clone , do_type_check = False
12601263 ).SerializeToString (),
1264+ sess_options = ort_session_options ,
12611265 providers = ORT_PROVIDERS ,
12621266 )
12631267 values = sess .run (names , {})
You can’t perform that action at this time.
0 commit comments