File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -145,15 +145,20 @@ def qonnx_download_model():
145
145
clize .run (download_model )
146
146
147
147
148
- def get_golden_in_and_output (test_model ):
149
- model = download_model (test_model , do_cleanup = True , return_modelwrapper = True )
150
- rng = np .random .RandomState (42 )
148
+ def get_random_input (test_model , seed = 42 ):
149
+ rng = np .random .RandomState (seed )
151
150
input_shape = test_model_details [test_model ]["input_shape" ]
152
151
(low , high ) = test_model_details [test_model ]["input_range" ]
153
152
size = np .prod (np .asarray (input_shape ))
154
153
input_tensor = rng .uniform (low = low , high = high , size = size )
155
154
input_tensor = input_tensor .astype (np .float32 )
156
155
input_tensor = input_tensor .reshape (input_shape )
156
+ return input_tensor
157
+
158
+
159
+ def get_golden_in_and_output (test_model , seed = 42 ):
160
+ model = download_model (test_model , do_cleanup = True , return_modelwrapper = True )
161
+ input_tensor = get_random_input (test_model , seed = seed )
157
162
input_dict = {model .graph .input [0 ].name : input_tensor }
158
163
golden_output_dict = oxe .execute_onnx (model , input_dict )
159
164
golden_result = golden_output_dict [model .graph .output [0 ].name ]
You can’t perform that action at this time.
0 commit comments