diff options
author | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2023-02-15 14:58:37 +0000 |
---|---|---|
committer | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2023-02-16 10:44:22 +0000 |
commit | a01e0e1229e30f9e2ebf3cd921ffe0dbef1cbea9 (patch) | |
tree | 811585649f513c2182f26a64751c986c7a66be83 /tests/test_target_ethos_u_advisor.py | |
parent | df856cc9f20670ade3e84511f0fcbcc11425705d (diff) | |
download | mlia-a01e0e1229e30f9e2ebf3cd921ffe0dbef1cbea9.tar.gz |
MLIA-812 Show error message for unsupported functionality0.6.0-rc.2
Change-Id: I68fb8c4e51046e9fc2d91ad8338718ba545209cd
Diffstat (limited to 'tests/test_target_ethos_u_advisor.py')
-rw-r--r-- | tests/test_target_ethos_u_advisor.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/test_target_ethos_u_advisor.py b/tests/test_target_ethos_u_advisor.py index fb68800..11aefc7 100644 --- a/tests/test_target_ethos_u_advisor.py +++ b/tests/test_target_ethos_u_advisor.py @@ -1,9 +1,31 @@ -# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. +# SPDX-FileCopyrightText: Copyright 2022-2023, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 """Tests for Ethos-U MLIA module.""" +from pathlib import Path + +import pytest + +from mlia.core.common import AdviceCategory +from mlia.core.context import ExecutionContext +from mlia.target.ethos_u.advisor import configure_and_get_ethosu_advisor from mlia.target.ethos_u.advisor import EthosUInferenceAdvisor def test_advisor_metadata() -> None: """Test advisor metadata.""" assert EthosUInferenceAdvisor.name() == "ethos_u_inference_advisor" + + +def test_unsupported_advice_categories(tmp_path: Path, test_tflite_model: Path) -> None: + """Test that advisor should throw an exception for unsupported categories.""" + with pytest.raises( + Exception, match="Optimizations are not supported for TensorFlow Lite files." + ): + ctx = ExecutionContext( + output_dir=tmp_path, advice_category={AdviceCategory.OPTIMIZATION} + ) + + advisor = configure_and_get_ethosu_advisor( + ctx, "ethos-u55-256", str(test_tflite_model) + ) + advisor.configure(ctx) |