Skip to content

Commit da9b92d

Browse files
Arm test: Pass inputs to run_method_and_compare_outputs (#3750)
Summary: Pass inputs to ArmTester.run_method_and_compare_outputs to make sure that the test data is from the same distribution as the calibration data. Change-Id: I690b9a22c1e12465364998bdaddd4903bcc1c18f Pull Request resolved: #3750 Reviewed By: kirklandsign Differential Revision: D58137923 Pulled By: digantdesai fbshipit-source-id: be335489824855c7ac8cb6aed77c2f723276191d
1 parent 089858b commit da9b92d

13 files changed

+28
-26
lines changed

backends/arm/test/models/test_mobilenet_v2_arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_mv2_tosa_MI(self):
6060
.check(list(self.all_operators))
6161
.partition()
6262
.to_executorch()
63-
.run_method_and_compare_outputs()
63+
.run_method_and_compare_outputs(inputs=self.model_inputs)
6464
)
6565

6666
def test_mv2_tosa_BI(self):

backends/arm/test/ops/test_add.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _test_add_tosa_MI_pipeline(
7171
.partition()
7272
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
7373
.to_executorch()
74-
.run_method_and_compare_outputs()
74+
.run_method_and_compare_outputs(inputs=test_data)
7575
)
7676

7777
def _test_add_tosa_BI_pipeline(
@@ -91,7 +91,7 @@ def _test_add_tosa_BI_pipeline(
9191
.partition()
9292
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
9393
.to_executorch()
94-
.run_method_and_compare_outputs(qtol=1)
94+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
9595
)
9696

9797
def _test_add_u55_BI_pipeline(

backends/arm/test/ops/test_avg_pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _test_avgpool2d_tosa_MI_pipeline(
6060
.check_not(["executorch_exir_dialects_edge__ops_aten_avg_pool2d_default"])
6161
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
6262
.to_executorch()
63-
.run_method_and_compare_outputs()
63+
.run_method_and_compare_outputs(inputs=test_data)
6464
)
6565

6666
def _test_avgpool2d_tosa_BI_pipeline(
@@ -81,7 +81,7 @@ def _test_avgpool2d_tosa_BI_pipeline(
8181
.check_not(["executorch_exir_dialects_edge__ops_aten_avg_pool2d_default"])
8282
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
8383
.to_executorch()
84-
.run_method_and_compare_outputs(qtol=1)
84+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
8585
)
8686

8787
def _test_avgpool2d_tosa_u55_BI_pipeline(

backends/arm/test/ops/test_batch_norm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def _test_batchnorm2d_tosa_MI_pipeline(
552552
]
553553
)
554554
.to_executorch()
555-
.run_method_and_compare_outputs(test_data)
555+
.run_method_and_compare_outputs(inputs=test_data)
556556
)
557557

558558
def _test_batchnorm2d_no_stats_tosa_MI_pipeline(
@@ -581,7 +581,7 @@ def _test_batchnorm2d_no_stats_tosa_MI_pipeline(
581581
]
582582
)
583583
.to_executorch()
584-
.run_method_and_compare_outputs(test_data)
584+
.run_method_and_compare_outputs(inputs=test_data)
585585
)
586586

587587
def _test_batchnorm2d_tosa_BI_pipeline(
@@ -613,7 +613,7 @@ def _test_batchnorm2d_tosa_BI_pipeline(
613613
]
614614
)
615615
.to_executorch()
616-
.run_method_and_compare_outputs(test_data)
616+
.run_method_and_compare_outputs(inputs=test_data)
617617
)
618618

619619
def _test_batchnorm2d_u55_BI_pipeline(

backends/arm/test/ops/test_clone.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _test_clone_tosa_MI_pipeline(
4747
.partition()
4848
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
4949
.to_executorch()
50-
.run_method_and_compare_outputs(qtol=1)
50+
.run_method_and_compare_outputs(inputs=test_data)
5151
)
5252

5353
def _test_clone_tosa_BI_pipeline(
@@ -66,7 +66,7 @@ def _test_clone_tosa_BI_pipeline(
6666
.partition()
6767
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
6868
.to_executorch()
69-
.run_method_and_compare_outputs(qtol=1)
69+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
7070
)
7171

7272
def _test_clone_tosa_u55_pipeline(

backends/arm/test/ops/test_conv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def _test_conv2d_tosa_MI_pipeline(
256256
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
257257
.check_not(["executorch_exir_dialects_edge__ops_aten_convolution_default"])
258258
.to_executorch()
259-
.run_method_and_compare_outputs()
259+
.run_method_and_compare_outputs(inputs=test_data)
260260
)
261261

262262
def _test_conv2d_tosa_BI_pipeline(
@@ -277,7 +277,7 @@ def _test_conv2d_tosa_BI_pipeline(
277277
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
278278
.check_not(["executorch_exir_dialects_edge__ops_aten_convolution_default"])
279279
.to_executorch()
280-
.run_method_and_compare_outputs(qtol=1)
280+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
281281
)
282282

283283
def _test_conv2d_u55_BI_pipeline(

backends/arm/test/ops/test_conv_combos.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def _test_conv_combo_tosa_MI_pipeline(
169169
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
170170
.check_not(list(module.edge_op_list))
171171
.to_executorch()
172-
.run_method_and_compare_outputs()
172+
.run_method_and_compare_outputs(inputs=test_data)
173173
)
174174

175175
def _test_conv_combo_tosa_BI_pipeline(
@@ -192,7 +192,9 @@ def _test_conv_combo_tosa_BI_pipeline(
192192
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
193193
.check_not(list(module.edge_op_list))
194194
.to_executorch()
195-
.run_method_and_compare_outputs(atol=atol, rtol=rtol, qtol=1)
195+
.run_method_and_compare_outputs(
196+
inputs=test_data, atol=atol, rtol=rtol, qtol=1
197+
)
196198
)
197199

198200
def _test_conv_combo_u55_BI_pipeline(

backends/arm/test/ops/test_depthwise_conv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def _test_dw_conv2d_tosa_MI_pipeline(
142142
.check_not(["executorch_exir_dialects_edge__ops_aten_convolution_default"])
143143
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
144144
.to_executorch()
145-
.run_method_and_compare_outputs()
145+
.run_method_and_compare_outputs(inputs=test_data)
146146
)
147147

148148
def _test_dw_conv2d_tosa_BI_pipeline(
@@ -161,7 +161,7 @@ def _test_dw_conv2d_tosa_BI_pipeline(
161161
.check_not(["executorch_exir_dialects_edge__ops_aten_convolution_default"])
162162
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
163163
.to_executorch()
164-
.run_method_and_compare_outputs(qtol=1)
164+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
165165
)
166166

167167
def _test_dw_conv2d_u55_BI_pipeline(

backends/arm/test/ops/test_div.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def _test_div_tosa_MI_pipeline(
117117
.partition()
118118
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
119119
.to_executorch()
120-
.run_method_and_compare_outputs(test_data)
120+
.run_method_and_compare_outputs(inputs=test_data)
121121
)
122122

123123
def _test_div_tosa_BI_pipeline(
@@ -137,7 +137,7 @@ def _test_div_tosa_BI_pipeline(
137137
.partition()
138138
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
139139
.to_executorch()
140-
.run_method_and_compare_outputs(test_data)
140+
.run_method_and_compare_outputs(inputs=test_data)
141141
)
142142

143143
def _test_div_u55_BI_pipeline(

backends/arm/test/ops/test_linear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def _test_linear_tosa_MI_pipeline(
129129
.partition()
130130
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
131131
.to_executorch()
132-
.run_method_and_compare_outputs()
132+
.run_method_and_compare_outputs(inputs=test_data)
133133
)
134134

135135
def _test_linear_tosa_BI_pipeline(
@@ -149,7 +149,7 @@ def _test_linear_tosa_BI_pipeline(
149149
.partition()
150150
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
151151
.to_executorch()
152-
.run_method_and_compare_outputs(qtol=True)
152+
.run_method_and_compare_outputs(inputs=test_data, qtol=True)
153153
)
154154

155155
def _test_linear_tosa_u55_BI_pipeline(

backends/arm/test/ops/test_mean_dim.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def _test_meandim_tosa_MI_pipeline(
6565
.check_not(["executorch_exir_dialects_edge__ops_aten_mean_dim"])
6666
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
6767
.to_executorch()
68-
.run_method_and_compare_outputs()
68+
.run_method_and_compare_outputs(inputs=test_data)
6969
)
7070

7171
def _test_meandim_tosa_BI_pipeline(
@@ -86,7 +86,7 @@ def _test_meandim_tosa_BI_pipeline(
8686
.check_not(["executorch_exir_dialects_edge__ops_aten_mean_dim"])
8787
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
8888
.to_executorch()
89-
.run_method_and_compare_outputs(qtol=1)
89+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
9090
)
9191

9292
def _test_meandim_tosa_u55_BI_pipeline(

backends/arm/test/ops/test_softmax.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _test_softmax_tosa_MI_pipeline(
5353
.check_not(["executorch_exir_dialects_edge__ops_aten__softmax_default"])
5454
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
5555
.to_executorch()
56-
.run_method_and_compare_outputs()
56+
.run_method_and_compare_outputs(inputs=test_data)
5757
)
5858

5959
def _test_softmax_tosa_BI_pipeline(
@@ -74,7 +74,7 @@ def _test_softmax_tosa_BI_pipeline(
7474
.check_not(["executorch_exir_dialects_edge__ops_aten__softmax_default"])
7575
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
7676
.to_executorch()
77-
.run_method_and_compare_outputs(qtol=1)
77+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
7878
)
7979

8080
def _test_softmax_tosa_u55_BI_pipeline(

backends/arm/test/ops/test_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def _test_view_tosa_MI_pipeline(
4444
.partition()
4545
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
4646
.to_executorch()
47-
.run_method_and_compare_outputs(qtol=1)
47+
.run_method_and_compare_outputs(inputs=test_data)
4848
)
4949

5050
def _test_view_tosa_BI_pipeline(
@@ -63,7 +63,7 @@ def _test_view_tosa_BI_pipeline(
6363
.partition()
6464
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
6565
.to_executorch()
66-
.run_method_and_compare_outputs(qtol=1)
66+
.run_method_and_compare_outputs(inputs=test_data, qtol=1)
6767
)
6868

6969
def _test_view_u55_BI_pipeline(

0 commit comments

Comments
 (0)