Skip to content

Commit 6a2b7e6

Browse files
authored
fix nxp test dependency issue (#18641)
Summary: patch missing dependency and skip tflite-required test if tflite inavailable, to bring nxp ci back Differential Revision: D99130538
1 parent 4e79ee4 commit 6a2b7e6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

backends/nxp/tests/BUCK

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fbcode_target(_kind = runtime.python_library,
2323
deps = [
2424
"//executorch/exir:lib",
2525
"//executorch/extension/export_util:export_util",
26-
"//pytorch/ao:torchao",
26+
"//pytorch/ao:torchao",
2727
"//executorch/backends/nxp:quantizer",
2828
"//executorch/backends/nxp:neutron_backend",
2929
"//executorch/backends/nxp:edge_passes",
@@ -39,6 +39,8 @@ fbcode_target(_kind = python_pytest,
3939
"//executorch/backends/nxp:quantizer",
4040
"//caffe2:torch",
4141
"//executorch/backends/nxp/tests:models",
42+
":executorch_pipeline",
43+
"fbsource//third-party/pypi/pytest-mock:pytest-mock", # @manual
4244
],
4345
)
4446

backends/nxp/tests/test_quantizer.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,17 @@
2626
from executorch.backends.nxp.tests.executors import (
2727
convert_run_compare,
2828
graph_contains_any_of_ops,
29+
tflite,
2930
ToChannelFirstPreprocess,
3031
ToChannelLastPreprocess,
3132
)
33+
3234
from executorch.exir.dialects._ops import ops as exir_ops
35+
36+
requires_tflite = pytest.mark.skipif(
37+
tflite is None, reason="tensorflow/tflite not available"
38+
)
39+
3340
from torch.export import export, ExportedProgram
3441
from torch.fx import GraphModule
3542
from torchao.quantization.pt2e import (
@@ -400,6 +407,7 @@ def test_quantizers_order_invariance():
400407
assert all(n == n_reversed for n, n_reversed in zip(nodes, nodes_reversed))
401408

402409

410+
@requires_tflite
403411
@pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases)
404412
def test_quantizer__linear_w_activation(mocker, activation, inplace, use_qat):
405413
converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program")
@@ -447,6 +455,7 @@ def test_quantizer__linear_w_activation(mocker, activation, inplace, use_qat):
447455
)
448456

449457

458+
@requires_tflite
450459
@pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases)
451460
def test_quantizer__addmm_w_activation(mocker, activation, inplace, use_qat):
452461
converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program")
@@ -491,6 +500,7 @@ def test_quantizer__addmm_w_activation(mocker, activation, inplace, use_qat):
491500
)
492501

493502

503+
@requires_tflite
494504
@pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases)
495505
def test_quantizer__mm_w_activation(mocker, activation, inplace, use_qat):
496506
converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program")
@@ -535,6 +545,7 @@ def test_quantizer__mm_w_activation(mocker, activation, inplace, use_qat):
535545
)
536546

537547

548+
@requires_tflite
538549
@pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases)
539550
def test_quantizer__conv_w_activation(mocker, activation, inplace, use_qat):
540551
converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program")

0 commit comments

Comments
 (0)