aboutsummaryrefslogtreecommitdiff
path: root/tests/test_nn_tensorflow_utils.py
diff options
context:
space:
mode:
authorNathan Bailey <nathan.bailey@arm.com>2024-03-20 08:13:39 +0000
committerNathan Bailey <nathan.bailey@arm.com>2024-03-28 07:17:32 +0000
commitf3f3ab451968350b8f6df2de7c60b2c2b9320b59 (patch)
tree05d56c8e41de9b32f8054019a21b78628151310d /tests/test_nn_tensorflow_utils.py
parent5f063ae1cfbfa2568d2858af0a0ccaf192bb1e8d (diff)
downloadmlia-f3f3ab451968350b8f6df2de7c60b2c2b9320b59.tar.gz
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 <nathan.bailey@arm.com> Change-Id: I53bcaa9cdad58b0e6c311c8c6490393d33cb18bc
Diffstat (limited to 'tests/test_nn_tensorflow_utils.py')
-rw-r--r--tests/test_nn_tensorflow_utils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_nn_tensorflow_utils.py b/tests/test_nn_tensorflow_utils.py
index e356a49..4e0c1e1 100644
--- a/tests/test_nn_tensorflow_utils.py
+++ b/tests/test_nn_tensorflow_utils.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 re
@@ -7,6 +7,7 @@ from pathlib import Path
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.tflite_convert import convert_to_tflite
from mlia.nn.tensorflow.utils import check_tflite_datatypes
@@ -19,18 +20,18 @@ from mlia.nn.tensorflow.utils import save_keras_model
def test_save_keras_model(tmp_path: Path, test_keras_model: Path) -> None:
"""Test saving Keras 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.h5"
save_keras_model(keras_model, temp_file)
- loaded_model = tf.keras.models.load_model(temp_file)
+ loaded_model = keras.models.load_model(temp_file)
assert loaded_model.summary() == keras_model.summary()
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)