File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -169,12 +169,25 @@ def warmup(impl_fn, inputs):
169169 # Special case: if the benchmark implementation returns anything, then
170170 # add that to the results dict
171171 if retval is not None :
172- results_dict ["return-value" ] = retval
172+ results_dict ["return-value" ] = convert_to_numpy ( retval , fmwrk )
173173
174174 results_dict ["error_state" ] = ErrorCodes .SUCCESS
175175 results_dict ["error_msg" ] = ""
176176
177177
178+ def convert_to_numpy (value : any , fmwrk : Framework ) -> any :
179+ """Calls copy_from_func on all array values."""
180+ if isinstance (value , tuple ):
181+ retval_list = list (value )
182+ for i , _ in enumerate (retval_list ):
183+ retval_list [i ] = fmwrk .copy_from_func ()(retval_list [i ])
184+ value = tuple (retval_list )
185+ else :
186+ value = fmwrk .copy_from_func ()(value )
187+
188+ return value
189+
190+
178191class BenchmarkResults :
179192 """A helper class to store the results and timing from running a
180193 benchmark.
You can’t perform that action at this time.
0 commit comments