File size: 545 Bytes
0bf203c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import onnxruntime as rt

sess_options = rt.SessionOptions()
sess_options.graph_optimization_level = rt.GraphOptimizationLevel.ORT_ENABLE_ALL

#########################################
## Change the Path Accordingly
sess_options.optimized_model_filepath = "optimized_model.onnx"


#########################################
## Change the model.onnx path accordingly
session = rt.InferenceSession("model.onnx" , sess_options,
   ###providers=['xxxxxxxxxDmlExecutionProvider', 'CPUExecutionProvider'])
   providers=['DmlExecutionProvider'])