Skip to content

Commit af12daf

Browse files
committed
Revert "NXP backend: Fix group convolution merge conflict (#13894)"
This reverts commit 19a54bc.
1 parent 55a0ea7 commit af12daf

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

backends/nxp/tests/test_split_group_convolution.py

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,15 @@
1515
from executorch.backends.nxp.aten_passes.split_group_convolution import (
1616
SplitGroupConvolution,
1717
)
18-
from executorch.backends.nxp.neutron_partitioner import NeutronPartitioner
19-
from executorch.backends.nxp.nxp_backend import generate_neutron_compile_spec
20-
from executorch.backends.nxp.tests.executorch_pipeline import (
21-
_quantize_model,
22-
get_random_calibration_inputs,
23-
to_model_input_spec,
24-
)
18+
from executorch.backends.nxp.tests.executorch_pipeline import to_quantized_edge_program
2519
from executorch.backends.nxp.tests.executors import graph_contains_any_of_ops
2620
from executorch.backends.nxp.tests.models import (
2721
Conv1dModule,
2822
Conv2dModule,
2923
Conv3dModule,
3024
)
31-
from executorch.exir import EdgeCompileConfig, EdgeProgramManager
3225
from executorch.exir.dialects._ops import ops as exir_ops
33-
from executorch.extension.export_util import export_to_edge
3426
from parameterized import parameterized
35-
from torch.fx import GraphModule
36-
37-
38-
def _quantize_and_lower_module(
39-
module: GraphModule, input_shape: tuple[int, ...], target="imxrt700"
40-
) -> EdgeProgramManager:
41-
calibration_inputs = get_random_calibration_inputs(to_model_input_spec(input_shape))
42-
43-
exir_program_aten__module_quant = _quantize_model(module, calibration_inputs)
44-
45-
edge_compile_config = EdgeCompileConfig(_check_ir_validity=False)
46-
edge_program_manager = export_to_edge(
47-
exir_program_aten__module_quant,
48-
calibration_inputs[0],
49-
edge_compile_config=edge_compile_config,
50-
)
51-
52-
compile_spec = generate_neutron_compile_spec(target, "SDK_25_03")
53-
partitioner = NeutronPartitioner(compile_spec)
54-
return edge_program_manager.to_backend(partitioner)
5527

5628

5729
class TestSplitGroupConvolution(unittest.TestCase):
@@ -109,7 +81,7 @@ def test_split_group_convolution__2d(self, _, input_shape: list[int], group: int
10981
assert np.allclose(out1, out2, atol=2.0e-7)
11082

11183
# Make sure the graph can be correctly quantized and lowered to edge.
112-
ep = _quantize_and_lower_module(
84+
ep = to_quantized_edge_program(
11385
modified_module, tuple(input_shape)
11486
).exported_program()
11587
nodes = list(ep.graph.nodes)
@@ -166,7 +138,7 @@ def test_split_group_convolution__1d(self, _, input_shape: list[int], group: int
166138
assert np.allclose(out1, out2, atol=2.0e-7)
167139

168140
# Make sure the graph can be correctly quantized and lowered to edge.
169-
ep = _quantize_and_lower_module(
141+
ep = to_quantized_edge_program(
170142
modified_module, tuple(input_shape)
171143
).exported_program()
172144
nodes = list(ep.graph.nodes)
@@ -254,7 +226,7 @@ def test_split_group_convolution__applied_by_default(self):
254226
assert np.allclose(out1, out2, atol=5.0e-7)
255227

256228
# Make sure the graph can be correctly quantized and lowered to edge.
257-
ep = _quantize_and_lower_module(
229+
ep = to_quantized_edge_program(
258230
modified_module, tuple(input_shape)
259231
).exported_program()
260232
nodes = list(ep.graph.nodes)

0 commit comments

Comments
 (0)