@@ -127,7 +127,6 @@ def measure_performance(model_call, synchronizer_func, warmup, trials):
127127 with test_compiler_util .naive_timer (duration_box , synchronizer_func ):
128128 model_call ()
129129 e2e_times .append (duration_box .value )
130- # This print will be captured by the log redirect in main
131130 print (f"Trial { i + 1 } : e2e={ duration_box .value :.4f} ms" , flush = True )
132131
133132 return outputs , test_compiler_util .get_timing_stats (e2e_times )
@@ -144,7 +143,6 @@ def save_outputs_to_json(outputs, file_path):
144143 if outputs is not None :
145144 for tensor in outputs :
146145 if tensor is not None :
147- # Convert tensor to numpy array, then to nested Python list
148146 serializable_outputs .append (tensor .numpy ().tolist ())
149147 else :
150148 serializable_outputs .append (None )
@@ -156,7 +154,6 @@ def save_outputs_to_json(outputs, file_path):
156154def test_single_model (args , model_path ):
157155 set_seed (123 )
158156
159- # These prints will be captured by the log redirect in main
160157 print (f"[Config] device: { args .device } " , flush = True )
161158 print (f"[Config] compiler: { args .compiler } " , flush = True )
162159 print (f"[Config] hardware: { get_hardware_name (args .device )} " , flush = True )
@@ -244,7 +241,6 @@ def main():
244241
245242 args = parser .parse_args ()
246243
247- # Create the output directory if it doesn't exist
248244 os .makedirs (args .test_device_path , exist_ok = True )
249245
250246 test_samples = []
@@ -260,26 +256,20 @@ def main():
260256 sample_idx = 0
261257 failed_samples = []
262258
263- # --- MODIFICATION START ---
264- # Store the root path object
265259 root_path_obj = Path (args .model_path )
266- # --- MODIFICATION END ---
267260
268261 for model_path in path_utils .get_recursively_model_path (args .model_path ):
269262 if not test_samples or os .path .abspath (model_path ) in test_samples :
270- # --- MODIFICATION START ---
271263 # Get relative path from the root model_path
272264 relative_path = Path (model_path ).relative_to (root_path_obj )
273265 # Replace path separators (like / or \) with _ to create a flat file name
274266 model_name = str (relative_path ).replace (os .path .sep , "_" )
275- # --- MODIFICATION END ---
276267
277268 log_file_path = os .path .join (args .test_device_path , f"{ model_name } .log" )
278269 json_file_path = os .path .join (
279270 args .test_device_path , f"{ model_name } _outputs.json"
280271 )
281272
282- # --- Redirect stdout/stderr to log file ---
283273 with open (log_file_path , "w" , encoding = "utf-8" ) as log_f :
284274 with redirect_stdout (log_f ), redirect_stderr (log_f ):
285275 print (
@@ -292,7 +282,6 @@ def main():
292282 if not success :
293283 failed_samples .append (model_path )
294284 else :
295- # Save outputs to JSON
296285 try :
297286 save_outputs_to_json (outputs , json_file_path )
298287 except Exception as e :
@@ -305,7 +294,6 @@ def main():
305294
306295 sample_idx += 1
307296
308- # --- Print final summary to console ---
309297 print (
310298 f"Totally { sample_idx } verified samples, failed { len (failed_samples )} samples."
311299 )
0 commit comments