Skip to content

Commit a249af3

Browse files
mcr229facebook-github-bot
authored andcommitted
dynamic mobilenetv2 (#2440)
Summary: Pull Request resolved: #2440 adding dynamism to mobilenetv2 and testing Reviewed By: kirklandsign Differential Revision: D54666427
1 parent b974004 commit a249af3

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

backends/xnnpack/test/models/mobilenet_v2.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ class TestMobileNetV2(unittest.TestCase):
2929
}
3030

3131
def test_fp32_mv2(self):
32+
dynamic_shapes = (
33+
{
34+
2: torch.export.Dim("height", min=224, max=455),
35+
3: torch.export.Dim("width", min=224, max=455),
36+
},
37+
)
3238

3339
(
34-
Tester(self.mv2, self.model_inputs)
40+
Tester(self.mv2, self.model_inputs, dynamic_shapes=dynamic_shapes)
3541
.export()
3642
.to_edge()
3743
.check(list(self.all_operators))
@@ -40,7 +46,7 @@ def test_fp32_mv2(self):
4046
.check_not(list(self.all_operators))
4147
.to_executorch()
4248
.serialize()
43-
.run_method_and_compare_outputs()
49+
.run_method_and_compare_outputs(num_runs=10)
4450
)
4551

4652
def test_qs8_mv2(self):
@@ -49,8 +55,15 @@ def test_qs8_mv2(self):
4955
"executorch_exir_dialects_edge__ops_aten__native_batch_norm_legit_no_training_default",
5056
}
5157

58+
dynamic_shapes = (
59+
{
60+
2: torch.export.Dim("height", min=224, max=455),
61+
3: torch.export.Dim("width", min=224, max=455),
62+
},
63+
)
64+
5265
(
53-
Tester(self.mv2, self.model_inputs)
66+
Tester(self.mv2, self.model_inputs, dynamic_shapes=dynamic_shapes)
5467
.quantize(Quantize(calibrate=False))
5568
.export()
5669
.to_edge()
@@ -60,5 +73,5 @@ def test_qs8_mv2(self):
6073
.check_not(list(ops_after_quantization))
6174
.to_executorch()
6275
.serialize()
63-
.run_method_and_compare_outputs()
76+
.run_method_and_compare_outputs(num_runs=10)
6477
)

0 commit comments

Comments
 (0)