From 87647b7bf1ee89b20aa87768ec8c82f329082db0 Mon Sep 17 00:00:00 2001 From: Benjamin Klimczak Date: Mon, 14 Aug 2023 14:17:45 +0100 Subject: MLIA-881 Update compatible operators for Cortex-A Update the compatibility information of the backend for ArmNN TensorFlow Lite Delegate (classic) to version 23.05. Change-Id: I84693842d1a883f7083a6faf7d5ddcd5ecc34e5d Signed-off-by: Benjamin Klimczak --- tests/test_backend_armnn_tflite_delegate_compat.py | 21 +++++++++++++++++++++ tests/test_target_cortex_a_data_analysis.py | 2 +- tests/test_target_cortex_a_operators.py | 17 ----------------- 3 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 tests/test_backend_armnn_tflite_delegate_compat.py (limited to 'tests') diff --git a/tests/test_backend_armnn_tflite_delegate_compat.py b/tests/test_backend_armnn_tflite_delegate_compat.py new file mode 100644 index 0000000..658e707 --- /dev/null +++ b/tests/test_backend_armnn_tflite_delegate_compat.py @@ -0,0 +1,21 @@ +# SPDX-FileCopyrightText: Copyright 2022-2023, Arm Limited and/or its affiliates. +# SPDX-License-Identifier: Apache-2.0 +"""Tests for ArmNN TensorFlow Lite Delegate backend.""" +from typing import cast + +from mlia.backend.armnn_tflite_delegate import compat +from mlia.nn.tensorflow.tflite_graph import TFL_OP + + +def test_compat_data() -> None: + """Make sure all data contains the necessary items.""" + builtin_tfl_ops = {op.name for op in TFL_OP} + assert "backend" in compat.ARMNN_TFLITE_DELEGATE + assert "ops" in compat.ARMNN_TFLITE_DELEGATE + + ops = cast(dict, compat.ARMNN_TFLITE_DELEGATE["ops"]) + for data in ops.values(): + assert "builtin_ops" in data + for comp in data["builtin_ops"]: + assert comp in builtin_tfl_ops + assert "custom_ops" in data diff --git a/tests/test_target_cortex_a_data_analysis.py b/tests/test_target_cortex_a_data_analysis.py index e033ef9..73d1126 100644 --- a/tests/test_target_cortex_a_data_analysis.py +++ b/tests/test_target_cortex_a_data_analysis.py @@ -47,7 +47,7 @@ BACKEND_INFO = f"{ARMNN_TFLITE_DELEGATE['backend']} {VERSION}" Operator( "CUSTOM", "somewhere else", - activation_func=TFL_ACTIVATION_FUNCTION.SIGN_BIT, + activation_func=TFL_ACTIVATION_FUNCTION.RELU6, custom_name="MaxPool3D", ), ], diff --git a/tests/test_target_cortex_a_operators.py b/tests/test_target_cortex_a_operators.py index 8bc48e6..56d6c7b 100644 --- a/tests/test_target_cortex_a_operators.py +++ b/tests/test_target_cortex_a_operators.py @@ -2,33 +2,16 @@ # SPDX-License-Identifier: Apache-2.0 """Tests for Cortex-A operator compatibility.""" from pathlib import Path -from typing import cast import pytest import tensorflow as tf -from mlia.backend.armnn_tflite_delegate import compat -from mlia.nn.tensorflow.tflite_graph import TFL_OP from mlia.nn.tensorflow.utils import convert_to_tflite from mlia.target.cortex_a.config import CortexAConfiguration from mlia.target.cortex_a.operators import CortexACompatibilityInfo from mlia.target.cortex_a.operators import get_cortex_a_compatibility_info -def test_compat_data() -> None: - """Make sure all data contains the necessary items.""" - builtin_tfl_ops = {op.name for op in TFL_OP} - assert "backend" in compat.ARMNN_TFLITE_DELEGATE - assert "ops" in compat.ARMNN_TFLITE_DELEGATE - - ops = cast(dict, compat.ARMNN_TFLITE_DELEGATE["ops"]) - for data in ops.values(): - assert "builtin_ops" in data - for comp in data["builtin_ops"]: - assert comp in builtin_tfl_ops - assert "custom_ops" in data - - def check_get_cortex_a_compatibility_info( model_path: Path, expected_success: bool, -- cgit v1.2.1