Skip to content

Commit 99d5b80

Browse files
committed
Update Q/DQ Folding pass test to sequence of ops
Signed-off-by: Per Åstrand <[email protected]> Change-Id: I2d133f4347d9999c770e5337162c222368c212f2
1 parent fd9eb28 commit 99d5b80

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

backends/arm/test/passes/test_fold_qdq_pass.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,20 @@
2020

2121

2222
class SimpleQuantizeModel(torch.nn.Module):
23-
def forward(self, x):
24-
return x + x
23+
def forward(self, x, y):
24+
return x + torch.max((x + x), (y + y))
2525

2626
def get_inputs(self):
27-
return (torch.rand(1, 1280, 7, 7),)
27+
return (torch.rand(1, 1280, 7, 7), torch.rand(1, 1280, 7, 7))
2828

2929

3030
class FoldAndAnnotateQParamsPassTestClass(FoldAndAnnotateQParamsPass):
3131
def __init__(self):
3232
super(FoldAndAnnotateQParamsPassTestClass, self).__init__(
33-
[exir_ops.edge.aten.add.Tensor]
33+
[
34+
exir_ops.edge.aten.add.Tensor,
35+
exir_ops.edge.aten.maximum.default,
36+
]
3437
)
3538

3639

@@ -58,15 +61,15 @@ def test_fold_qdq_pass(self):
5861
.to_edge()
5962
.check_count(
6063
{
61-
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 2,
62-
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 2,
64+
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 7,
65+
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 6,
6366
}
6467
)
6568
.run_passes(test_pass_stage)
6669
.check_count(
6770
{
6871
"executorch_exir_dialects_edge__ops_quantized_decomposed_dequantize_per_tensor_default": 1,
69-
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 1,
72+
"executorch_exir_dialects_edge__ops_quantized_decomposed_quantize_per_tensor_default": 2,
7073
}
7174
)
7275
)

0 commit comments

Comments
 (0)