diff options
author | Dhruv Chauhan <dhruv.chauhan@arm.com> | 2023-03-20 10:22:08 +0000 |
---|---|---|
committer | Dhruv Chauhan <dhruv.chauhan@arm.com> | 2023-03-24 12:44:23 +0000 |
commit | edf436c48029aa4e2b4ca5d17eee5a8f07ecbd6f (patch) | |
tree | 2375038e77873f6cd499b8938bc8b816daea3fc8 /tests/test_target_ethos_u_reporters.py | |
parent | 803a91c0723533f62148528a81f9d0411b57438e (diff) | |
download | mlia-edf436c48029aa4e2b4ca5d17eee5a8f07ecbd6f.tar.gz |
MLIA-711 Extend TensorFlow Lite Compatibility Check
- Unify the TensorFlow Lite compatibility check across Cortex-A, TOSA
and Ethos-U targets
- Display tables/messages with parsed information
- Do not display raw TensorFlow Lite errors, and return with exit code 0
Change-Id: I9333fdb6cbe592f1ed7395d392412168492a1479
Diffstat (limited to 'tests/test_target_ethos_u_reporters.py')
-rw-r--r-- | tests/test_target_ethos_u_reporters.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_target_ethos_u_reporters.py b/tests/test_target_ethos_u_reporters.py index b8014e4..debeeb2 100644 --- a/tests/test_target_ethos_u_reporters.py +++ b/tests/test_target_ethos_u_reporters.py @@ -3,6 +3,7 @@ """Tests for reports module.""" from __future__ import annotations +from typing import Any from typing import cast import pytest @@ -11,7 +12,10 @@ from mlia.backend.vela.compat import NpuSupported from mlia.backend.vela.compat import Operator from mlia.core.reporting import Report from mlia.core.reporting import Table +from mlia.nn.tensorflow.tflite_compat import TFLiteCompatibilityInfo +from mlia.nn.tensorflow.tflite_compat import TFLiteCompatibilityStatus from mlia.target.ethos_u.config import EthosUConfiguration +from mlia.target.ethos_u.reporters import ethos_u_formatters from mlia.target.ethos_u.reporters import report_operators from mlia.target.ethos_u.reporters import report_target_details from mlia.target.registry import profile @@ -231,3 +235,23 @@ def test_report_target_details( json_dict = report.to_json() assert json_dict == expected_json_dict + + +@pytest.mark.parametrize( + "data", + (TFLiteCompatibilityInfo(status=TFLiteCompatibilityStatus.COMPATIBLE),), +) +def test_ethos_u_formatters(data: Any) -> None: + """Test function ethos_u_formatters() with valid input.""" + formatter = ethos_u_formatters(data) + report = formatter(data) + assert isinstance(report, Report) + + +def test_ethos_u_formatters_invalid_data() -> None: + """Test function ethos_u_formatters() with invalid input.""" + with pytest.raises( + Exception, + match=r"^Unable to find appropriate formatter for .*", + ): + ethos_u_formatters(200) |