From 2e05e7d66d581f972aa458649193384e9f902ee5 Mon Sep 17 00:00:00 2001 From: "Yanan Cao (PyTorch)" Date: Thu, 19 Dec 2024 10:50:03 -0800 Subject: [PATCH] executorch/backends/qualcomm/tests (#7381) Summary: Pull Request resolved: https://github.com/pytorch/executorch/pull/7381 Reviewed By: avikchaudhuri, ydwu4 Differential Revision: D67381442 --- backends/qualcomm/tests/test_qnn_delegate.py | 11 +++++------ backends/qualcomm/tests/utils.py | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/backends/qualcomm/tests/test_qnn_delegate.py b/backends/qualcomm/tests/test_qnn_delegate.py index 37ff54a82d5..f9550d64832 100644 --- a/backends/qualcomm/tests/test_qnn_delegate.py +++ b/backends/qualcomm/tests/test_qnn_delegate.py @@ -1617,7 +1617,7 @@ def test_qnn_backend_multi_contexts_composite(self): ) sample_input = module.get_random_input() edge_prog = to_edge( - torch.export.export(module, sample_input), + torch.export.export(module, sample_input, strict=True), ) update_spill_fill_size(edge_prog.exported_program()) exec_prog = edge_prog.to_executorch() @@ -1957,7 +1957,7 @@ def calibrator(gm): self.assertEqual(len(exported_progs), 1) # lower all graph again, the skipped operators will be left in CPU exec_prog = to_edge( - torch.export.export(graph_module, sample_input), + torch.export.export(graph_module, sample_input, strict=True), ).to_executorch() self.verify_output(module, sample_input, exec_prog) @@ -2004,7 +2004,7 @@ def calibrator(gm): self.assertEqual(len(exported_progs), 2) # lower all graph again, the skipped operators will be left in CPU exec_prog = exec_prog = to_edge( - torch.export.export(graph_module, sample_input), + torch.export.export(graph_module, sample_input, strict=True), ).to_executorch() self.verify_output(module, sample_input, exec_prog) @@ -2041,7 +2041,7 @@ def calibrator(gm): self.assertEqual(len(exported_progs), 5) # lower all graph again, the skipped operators will be delegated with fp16 exec_prog = to_edge( - torch.export.export(graph_module, sample_input), + torch.export.export(graph_module, sample_input, strict=True), ).to_executorch() self.verify_output(module, sample_input, exec_prog) @@ -2086,7 +2086,7 @@ def test_qnn_backend_multi_contexts_composite(self): ) sample_input = module.get_random_input() edge_prog = to_edge( - torch.export.export(module, sample_input), + torch.export.export(module, sample_input, strict=True), ) update_spill_fill_size(edge_prog.exported_program()) exec_prog = edge_prog.to_executorch() @@ -2721,7 +2721,6 @@ def test_ssd300_vgg16(self): class TestExampleQaihubScript(TestQNN): - def required_envs(self, conditions=None) -> bool: conditions = [] if conditions is None else conditions return all( diff --git a/backends/qualcomm/tests/utils.py b/backends/qualcomm/tests/utils.py index 96591eb8906..9d78683eb98 100644 --- a/backends/qualcomm/tests/utils.py +++ b/backends/qualcomm/tests/utils.py @@ -385,7 +385,7 @@ def get_qdq_module( custom_quant_annotations: Tuple[Callable] = (), quant_dtype: QuantDtype = QuantDtype.use_8a8w, ) -> torch.fx.GraphModule: - m = torch.export.export(module, inputs).module() + m = torch.export.export(module, inputs, strict=True).module() quantizer = QnnQuantizer() quantizer.add_custom_quant_annotations(custom_quant_annotations)