@@ -68,7 +68,7 @@ def setUp(self):
6868 debug = False ,
6969 saver = False ,
7070 online_prepare = TestQNN .online_prepare ,
71- tensor_dump_output_path = "" ,
71+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
7272 profile = TestQNN .enable_profile ,
7373 shared_buffer = TestQNN .shared_buffer ,
7474 )
@@ -490,7 +490,7 @@ def setUp(self):
490490 debug = False ,
491491 saver = False ,
492492 online_prepare = TestQNN .online_prepare ,
493- tensor_dump_output_path = "" ,
493+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
494494 profile = TestQNN .enable_profile ,
495495 shared_buffer = TestQNN .shared_buffer ,
496496 )
@@ -604,7 +604,7 @@ def setUp(self):
604604 debug = False ,
605605 saver = False ,
606606 online_prepare = TestQNN .online_prepare ,
607- tensor_dump_output_path = "" ,
607+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
608608 profile = TestQNN .enable_profile ,
609609 shared_buffer = TestQNN .shared_buffer ,
610610 )
@@ -1121,7 +1121,7 @@ def setUp(self):
11211121 debug = False ,
11221122 saver = False ,
11231123 online_prepare = TestQNN .online_prepare ,
1124- tensor_dump_output_path = "" ,
1124+ dump_intermediate_outputs = TestQNN . dump_intermediate_outputs ,
11251125 profile = TestQNN .enable_profile ,
11261126 shared_buffer = TestQNN .shared_buffer ,
11271127 )
@@ -1287,6 +1287,22 @@ def setUp(self):
12871287 saver = False ,
12881288 )
12891289
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+
12901306 def test_qnn_backend_skip_node_id (self ):
12911307 module = SimpleModel () # noqa: F405
12921308 sample_input = (torch .ones (1 , 32 , 28 , 28 ), torch .ones (1 , 32 , 28 , 28 ))
@@ -1442,6 +1458,23 @@ def setUp(self):
14421458 saver = False ,
14431459 )
14441460
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+
14451478 def test_qnn_backend_skip_node_id_partitioner (self ):
14461479 module = SimpleModel () # noqa: F405
14471480 sample_input = (torch .ones (1 , 32 , 28 , 28 ), torch .ones (1 , 32 , 28 , 28 ))
@@ -2720,6 +2753,7 @@ def setup_environment():
27202753 TestQNN .oss_repo = args .oss_repo
27212754 TestQNN .shared_buffer = args .shared_buffer
27222755 TestQNN .enable_x86_64 = args .enable_x86_64
2756+ TestQNN .dump_intermediate_outputs = args .dump_intermediate_outputs
27232757 return sys .argv [:1 ] + ns_args
27242758
27252759
0 commit comments