@@ -68,7 +68,7 @@ def setUp(self):
68
68
debug = False ,
69
69
saver = False ,
70
70
online_prepare = TestQNN .online_prepare ,
71
- tensor_dump_output_path = "" ,
71
+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
72
72
profile = TestQNN .enable_profile ,
73
73
shared_buffer = TestQNN .shared_buffer ,
74
74
)
@@ -490,7 +490,7 @@ def setUp(self):
490
490
debug = False ,
491
491
saver = False ,
492
492
online_prepare = TestQNN .online_prepare ,
493
- tensor_dump_output_path = "" ,
493
+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
494
494
profile = TestQNN .enable_profile ,
495
495
shared_buffer = TestQNN .shared_buffer ,
496
496
)
@@ -604,7 +604,7 @@ def setUp(self):
604
604
debug = False ,
605
605
saver = False ,
606
606
online_prepare = TestQNN .online_prepare ,
607
- tensor_dump_output_path = "" ,
607
+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
608
608
profile = TestQNN .enable_profile ,
609
609
shared_buffer = TestQNN .shared_buffer ,
610
610
)
@@ -1121,7 +1121,7 @@ def setUp(self):
1121
1121
debug = False ,
1122
1122
saver = False ,
1123
1123
online_prepare = TestQNN .online_prepare ,
1124
- tensor_dump_output_path = "" ,
1124
+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
1125
1125
profile = TestQNN .enable_profile ,
1126
1126
shared_buffer = TestQNN .shared_buffer ,
1127
1127
)
@@ -1287,6 +1287,22 @@ def setUp(self):
1287
1287
saver = False ,
1288
1288
)
1289
1289
1290
+ def test_qnn_backend_dump_intermediate_outputs (self ):
1291
+ backend_options = generate_htp_compiler_spec (use_fp16 = True )
1292
+ TestQNN .compiler_specs = generate_qnn_executorch_compiler_spec (
1293
+ soc_model = self .arch_table [TestQNN .model ],
1294
+ backend_options = backend_options ,
1295
+ dump_intermediate_outputs = True ,
1296
+ )
1297
+ module = Relu () # noqa: F405
1298
+ sample_input = (torch .randn ([2 , 5 , 1 , 3 ]),)
1299
+ self .lower_module_and_test_output (
1300
+ module ,
1301
+ sample_input ,
1302
+ expected_partitions = 1 ,
1303
+ expected_intermediate_events = 3 ,
1304
+ )
1305
+
1290
1306
def test_qnn_backend_skip_node_id (self ):
1291
1307
module = SimpleModel () # noqa: F405
1292
1308
sample_input = (torch .ones (1 , 32 , 28 , 28 ), torch .ones (1 , 32 , 28 , 28 ))
@@ -1442,6 +1458,23 @@ def setUp(self):
1442
1458
saver = False ,
1443
1459
)
1444
1460
1461
+ def test_qnn_backend_dump_intermediate_outputs (self ):
1462
+ backend_options = generate_htp_compiler_spec (use_fp16 = False )
1463
+ TestQNN .compiler_specs = generate_qnn_executorch_compiler_spec (
1464
+ soc_model = self .arch_table [TestQNN .model ],
1465
+ backend_options = backend_options ,
1466
+ dump_intermediate_outputs = True ,
1467
+ )
1468
+ module = Relu () # noqa: F405
1469
+ sample_input = (torch .randn ([2 , 5 , 1 , 3 ]),)
1470
+ module = self .get_qdq_module (module , sample_input )
1471
+ self .lower_module_and_test_output (
1472
+ module ,
1473
+ sample_input ,
1474
+ expected_partitions = 1 ,
1475
+ expected_intermediate_events = 5 ,
1476
+ )
1477
+
1445
1478
def test_qnn_backend_skip_node_id_partitioner (self ):
1446
1479
module = SimpleModel () # noqa: F405
1447
1480
sample_input = (torch .ones (1 , 32 , 28 , 28 ), torch .ones (1 , 32 , 28 , 28 ))
@@ -2720,6 +2753,7 @@ def setup_environment():
2720
2753
TestQNN .oss_repo = args .oss_repo
2721
2754
TestQNN .shared_buffer = args .shared_buffer
2722
2755
TestQNN .enable_x86_64 = args .enable_x86_64
2756
+ TestQNN .dump_intermediate_outputs = args .dump_intermediate_outputs
2723
2757
return sys .argv [:1 ] + ns_args
2724
2758
2725
2759
0 commit comments