|
26 | 26 | from executorch.backends.nxp.tests.executors import ( |
27 | 27 | convert_run_compare, |
28 | 28 | graph_contains_any_of_ops, |
| 29 | + tflite, |
29 | 30 | ToChannelFirstPreprocess, |
30 | 31 | ToChannelLastPreprocess, |
31 | 32 | ) |
| 33 | + |
32 | 34 | 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 | + |
33 | 40 | from torch.export import export, ExportedProgram |
34 | 41 | from torch.fx import GraphModule |
35 | 42 | from torchao.quantization.pt2e import ( |
@@ -400,6 +407,7 @@ def test_quantizers_order_invariance(): |
400 | 407 | assert all(n == n_reversed for n, n_reversed in zip(nodes, nodes_reversed)) |
401 | 408 |
|
402 | 409 |
|
| 410 | +@requires_tflite |
403 | 411 | @pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases) |
404 | 412 | def test_quantizer__linear_w_activation(mocker, activation, inplace, use_qat): |
405 | 413 | converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program") |
@@ -447,6 +455,7 @@ def test_quantizer__linear_w_activation(mocker, activation, inplace, use_qat): |
447 | 455 | ) |
448 | 456 |
|
449 | 457 |
|
| 458 | +@requires_tflite |
450 | 459 | @pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases) |
451 | 460 | def test_quantizer__addmm_w_activation(mocker, activation, inplace, use_qat): |
452 | 461 | converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program") |
@@ -491,6 +500,7 @@ def test_quantizer__addmm_w_activation(mocker, activation, inplace, use_qat): |
491 | 500 | ) |
492 | 501 |
|
493 | 502 |
|
| 503 | +@requires_tflite |
494 | 504 | @pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases) |
495 | 505 | def test_quantizer__mm_w_activation(mocker, activation, inplace, use_qat): |
496 | 506 | converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program") |
@@ -535,6 +545,7 @@ def test_quantizer__mm_w_activation(mocker, activation, inplace, use_qat): |
535 | 545 | ) |
536 | 546 |
|
537 | 547 |
|
| 548 | +@requires_tflite |
538 | 549 | @pytest.mark.parametrize("activation, inplace, use_qat", all_activation_cases) |
539 | 550 | def test_quantizer__conv_w_activation(mocker, activation, inplace, use_qat): |
540 | 551 | converter_spy = mocker.spy(EdgeProgramToIRConverter, "convert_program") |
|
0 commit comments