From ce9b17650d024886b24ad820f0f1815fc23b19f3 Mon Sep 17 00:00:00 2001 From: Benjamin Klimczak Date: Mon, 7 Nov 2022 12:57:15 +0000 Subject: MLIA-701 Update dependencies - Update TensorFlow dependencies for x86_64 - Adapt unit tests to new TensorFlow version - Update linters (including pre-commit hooks) and fix issues - Use conditional import to fix tflite compat code for aarch64 Change-Id: I1a9b080b900ab65e38f7f2552562822bbfdcd259 --- tests/test_backend_application.py | 1 - tests/test_backend_common.py | 2 +- tests/test_backend_execution.py | 1 - tests/test_backend_fs.py | 1 - tests/test_backend_proc.py | 2 +- tests/test_backend_source.py | 1 - tests/test_core_events.py | 4 +--- tests/test_nn_tensorflow_tflite_compat.py | 8 ++++---- 8 files changed, 7 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/test_backend_application.py b/tests/test_backend_application.py index 9606802..478658b 100644 --- a/tests/test_backend_application.py +++ b/tests/test_backend_application.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -# pylint: disable=no-self-use """Tests for the application backend.""" from __future__ import annotations diff --git a/tests/test_backend_common.py b/tests/test_backend_common.py index 40a0cff..4f4853e 100644 --- a/tests/test_backend_common.py +++ b/tests/test_backend_common.py @@ -1,6 +1,6 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -# pylint: disable=no-self-use,protected-access +# pylint: disable=protected-access """Tests for the common backend module.""" from __future__ import annotations diff --git a/tests/test_backend_execution.py b/tests/test_backend_execution.py index 6e1b30b..e56a1b0 100644 --- a/tests/test_backend_execution.py +++ b/tests/test_backend_execution.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -# pylint: disable=no-self-use """Test backend execution module.""" from pathlib import Path from typing import Any diff --git a/tests/test_backend_fs.py b/tests/test_backend_fs.py index 21226a9..292a7cc 100644 --- a/tests/test_backend_fs.py +++ b/tests/test_backend_fs.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -# pylint: disable=no-self-use """Module for testing fs.py.""" from __future__ import annotations diff --git a/tests/test_backend_proc.py b/tests/test_backend_proc.py index 99e0bd5..d2c2cd4 100644 --- a/tests/test_backend_proc.py +++ b/tests/test_backend_proc.py @@ -1,6 +1,6 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -# pylint: disable=attribute-defined-outside-init,no-self-use,not-callable +# pylint: disable=attribute-defined-outside-init,not-callable """Pytests for testing mlia/backend/proc.py.""" from pathlib import Path from typing import Any diff --git a/tests/test_backend_source.py b/tests/test_backend_source.py index 11f1781..c6ef26f 100644 --- a/tests/test_backend_source.py +++ b/tests/test_backend_source.py @@ -1,6 +1,5 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 -# pylint: disable=no-self-use """Tests for the source backend module.""" from collections import Counter from contextlib import ExitStack as does_not_raise diff --git a/tests/test_core_events.py b/tests/test_core_events.py index a531bab..d2b7c94 100644 --- a/tests/test_core_events.py +++ b/tests/test_core_events.py @@ -105,9 +105,7 @@ def test_event_dispatcher(capsys: pytest.CaptureFixture) -> None: class SampleEventHandler(EventDispatcher): """Sample event handler.""" - def on_sample_event( # pylint: disable=no-self-use - self, _event: SampleEvent - ) -> None: + def on_sample_event(self, _event: SampleEvent) -> None: """Event handler for SampleEvent.""" print("Got sample event") diff --git a/tests/test_nn_tensorflow_tflite_compat.py b/tests/test_nn_tensorflow_tflite_compat.py index c330fdb..1bd4c34 100644 --- a/tests/test_nn_tensorflow_tflite_compat.py +++ b/tests/test_nn_tensorflow_tflite_compat.py @@ -8,8 +8,8 @@ from unittest.mock import MagicMock import pytest import tensorflow as tf from tensorflow.lite.python import convert -from tensorflow.lite.python.metrics import converter_error_data_pb2 +from mlia.nn.tensorflow.tflite_compat import converter_error_data_pb2 from mlia.nn.tensorflow.tflite_compat import TFLiteChecker from mlia.nn.tensorflow.tflite_compat import TFLiteCompatibilityInfo from mlia.nn.tensorflow.tflite_compat import TFLiteConversionError @@ -21,7 +21,7 @@ def test_not_fully_compatible_model_flex_ops() -> None: model = tf.keras.models.Sequential( [ tf.keras.layers.Dense(units=1, input_shape=[1], batch_size=1), - tf.keras.layers.Dense(units=16, activation="gelu"), + tf.keras.layers.Dense(units=16, activation="softsign"), tf.keras.layers.Dense(units=1), ] ) @@ -36,9 +36,9 @@ def test_not_fully_compatible_model_flex_ops() -> None: conv_err = result.conversion_errors[0] assert isinstance(conv_err, TFLiteConversionError) - assert conv_err.message == "'tf.Erf' op is neither a custom op nor a flex op" + assert conv_err.message == "'tf.Softsign' op is neither a custom op nor a flex op" assert conv_err.code == TFLiteConversionErrorCode.NEEDS_FLEX_OPS - assert conv_err.operator == "tf.Erf" + assert conv_err.operator == "tf.Softsign" assert len(conv_err.location) == 3 -- cgit v1.2.1