blob: 11aefc767c13097edaf3b9818153aa73003c72b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# 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)
|