@@ -458,6 +458,10 @@ def run_method_and_compare_outputs(
458
458
for run_iteration in range (num_runs ):
459
459
reference_input = inputs if inputs else next (self .generate_random_inputs ())
460
460
461
+ # Avoid issues with inplace operators
462
+ test_input = copy .deepcopy (reference_input )
463
+ original_input = copy .deepcopy (reference_input )
464
+
461
465
input_shapes = [
462
466
generated_input .shape if hasattr (generated_input , "shape" ) else (1 ,)
463
467
for generated_input in reference_input
@@ -472,16 +476,16 @@ def run_method_and_compare_outputs(
472
476
# Run exported module directly
473
477
test_outputs , _ = pytree .tree_flatten (
474
478
self ._calculate_reference_output (
475
- exported_program .module (), reference_input
479
+ exported_program .module (), test_input
476
480
)
477
481
)
478
482
else :
479
483
# Run lowered model with target
480
484
test_outputs , _ = pytree .tree_flatten (
481
- test_stage .run_artifact (reference_input )
485
+ test_stage .run_artifact (test_input )
482
486
)
483
487
484
- logger .info (f"\n Input: { reference_input } " )
488
+ logger .info (f"\n Input: { original_input } " )
485
489
logger .info (f"\n Ref output: { reference_outputs } " )
486
490
logger .info (f"\n Test output: { test_outputs } " )
487
491
0 commit comments