Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conv Combos with Simulator #6977

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions backends/arm/test/ops/test_conv_combos.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,33 @@ def _test_conv_combo_ethos_BI_pipeline(
if conftest.is_option_enabled("corstone_fvp"):
tester.run_method_and_compare_outputs(qtol=1, inputs=test_data)

def _test_conv_combo_ethos_MI_pipeline(
self,
module: torch.nn.Module,
compile_spec: CompileSpec,
test_data: Tuple[torch.Tensor],
atol: float = 1e-3,
rtol: float = 1e-3,
):
(
ArmTester(
module,
example_inputs=test_data,
compile_spec=compile_spec,
)
.quantize()
.export()
.to_edge()
.partition()
.check_count({"torch.ops.higher_order.executorch_call_delegate": 1})
.check_not(list(module.edge_op_list))
.to_executorch()
.serialize()
.run_method_and_compare_outputs(
inputs=test_data, atol=atol, rtol=rtol, qtol=1
)
)

####################
## Conv + meandim ##
####################
Expand All @@ -276,6 +303,15 @@ def test_conv_meandim_u55_BI(self):
model.get_inputs(),
)

@pytest.mark.corstone_fvp
def test_conv_meandim_u55_MI(self):
model = ComboConv2dMeandim()
self._test_conv_combo_ethos_MI_pipeline(
model,
common.get_u55_compile_spec(permute_memory_to_nhwc=True),
model.get_inputs(),
)

@pytest.mark.corstone_fvp
def test_conv_meandim_u85_BI(self):
model = ComboConv2dMeandim()
Expand Down Expand Up @@ -303,6 +339,13 @@ def test_conv_batchnorm_relu6_u55_BI(self):
model, common.get_u55_compile_spec(), model.get_inputs()
)

@pytest.mark.corstone_fvp
def test_conv_batchnorm_relu6_u55_MI(self):
model = ComboConvBatchnormRelu6()
self._test_conv_combo_ethos_MI_pipeline(
model, common.get_u55_compile_spec(), model.get_inputs()
)

@pytest.mark.corstone_fvp
def test_conv_batchnorm_relu_u85_BI(self):
model = ComboConvBatchnormRelu6()
Expand Down Expand Up @@ -336,6 +379,14 @@ def test_conv_relu6_u55_BI(self, test_data: torch.Tensor):
model, common.get_u55_compile_spec(permute_memory_to_nhwc=True), test_data
)

@parameterized.expand(ComboConvRelu6.test_data)
def test_conv_relu6_u55_MI(self, test_data: torch.Tensor):
model = ComboConvRelu6()
test_data = (test_data,)
self._test_conv_combo_ethos_MI_pipeline(
model, common.get_u55_compile_spec(permute_memory_to_nhwc=True), test_data
)

@parameterized.expand(ComboConvRelu6.test_data)
@pytest.mark.corstone_fvp
def test_conv_relu6_u85_BI(self, test_data: torch.Tensor):
Expand Down Expand Up @@ -367,6 +418,15 @@ def test_block_bottleneck_residual_u55_BI(self):
model.get_inputs(),
)

@pytest.mark.corstone_fvp
def test_block_bottleneck_residual_u55_MI(self):
model = ComboBlockBottleneckResidual()
self._test_conv_combo_ethos_MI_pipeline(
model,
common.get_u55_compile_spec(permute_memory_to_nhwc=True),
model.get_inputs(),
)

@pytest.mark.corstone_fvp
def test_block_bottleneck_residual_u85_BI(self):
model = ComboBlockBottleneckResidual()
Expand Down Expand Up @@ -402,6 +462,16 @@ def test_conv_avgpool2d_u55_BI(self, test_data: torch.Tensor):
test_data,
)

@parameterized.expand(ComboConvAvgPool2d.test_data)
def test_conv_avgpool2d_u55_MI(self, test_data: torch.Tensor):
model = ComboConvAvgPool2d()
test_data = (test_data,)
self._test_conv_combo_ethos_MI_pipeline(
model,
common.get_u55_compile_spec(),
test_data,
)

@parameterized.expand(ComboConvAvgPool2d.test_data)
@pytest.mark.corstone_fvp
def test_conv_avgpool2d_u85_BI(self, test_data: torch.Tensor):
Expand Down
Loading