From f3f3ab451968350b8f6df2de7c60b2c2b9320b59 Mon Sep 17 00:00:00 2001 From: Nathan Bailey Date: Wed, 20 Mar 2024 08:13:39 +0000 Subject: feat: Update Vela version Updates Vela Version to 3.11.0 and TensorFlow version to 2.15.1 Required keras import to change: from keras.api._v2 import keras needed instead of calling tf.keras Subsequently tf.keras.X needed to change to keras.X Resolves: MLIA-1107 Signed-off-by: Nathan Bailey Change-Id: I53bcaa9cdad58b0e6c311c8c6490393d33cb18bc --- tests/test_nn_tensorflow_tflite_convert.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tests/test_nn_tensorflow_tflite_convert.py') diff --git a/tests/test_nn_tensorflow_tflite_convert.py b/tests/test_nn_tensorflow_tflite_convert.py index 3125c04..81655b1 100644 --- a/tests/test_nn_tensorflow_tflite_convert.py +++ b/tests/test_nn_tensorflow_tflite_convert.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright 2022-2023, Arm Limited and/or its affiliates. +# SPDX-FileCopyrightText: Copyright 2022-2024, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 """Test for module utils/test_utils.""" import os @@ -9,6 +9,7 @@ from unittest.mock import MagicMock import numpy as np import pytest import tensorflow as tf +from keras.api._v2 import keras # Temporary workaround for now: MLIA-1107 from mlia.nn.tensorflow import tflite_convert from mlia.nn.tensorflow.tflite_convert import convert_to_tflite @@ -40,14 +41,14 @@ def test_convert_saved_model_to_tflite(test_tf_model: Path) -> None: def test_convert_keras_to_tflite(test_keras_model: Path) -> None: """Test converting Keras model to TensorFlow Lite.""" - keras_model = tf.keras.models.load_model(str(test_keras_model)) + keras_model = keras.models.load_model(str(test_keras_model)) result = convert_to_tflite_bytes(keras_model) assert isinstance(result, bytes) def test_save_tflite_model(tmp_path: Path, test_keras_model: Path) -> None: """Test saving TensorFlow Lite model.""" - keras_model = tf.keras.models.load_model(str(test_keras_model)) + keras_model = keras.models.load_model(str(test_keras_model)) temp_file = tmp_path / "test_model_saving.tflite" convert_to_tflite(keras_model, output_path=temp_file) -- cgit v1.2.1