aboutsummaryrefslogtreecommitdiff
path: root/tests/test_nn_tensorflow_optimizations_pruning.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_optimizations_pruning.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_optimizations_pruning.py')
-rw-r--r--tests/test_nn_tensorflow_optimizations_pruning.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_nn_tensorflow_optimizations_pruning.py b/tests/test_nn_tensorflow_optimizations_pruning.py
index 9afc3ff..c942d83 100644
--- a/tests/test_nn_tensorflow_optimizations_pruning.py
+++ b/tests/test_nn_tensorflow_optimizations_pruning.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 optimizations/pruning."""
from __future__ import annotations
@@ -6,7 +6,7 @@ from __future__ import annotations
from pathlib import Path
import pytest
-import tensorflow as tf
+from keras.api._v2 import keras # Temporary workaround for now: MLIA-1107
from numpy.core.numeric import isclose
from mlia.nn.tensorflow.optimizations.pruning import Pruner
@@ -47,7 +47,7 @@ def _test_check_sparsity(base_tflite_metrics: TFLiteMetrics) -> None:
def _get_tflite_metrics(
- path: Path, tflite_fn: str, model: tf.keras.Model
+ path: Path, tflite_fn: str, model: keras.Model
) -> TFLiteMetrics:
"""Save model as TFLiteModel and return metrics."""
temp_file = path / tflite_fn
@@ -70,7 +70,7 @@ def test_prune_simple_model_fully(
batch_size = 1
num_epochs = 1
- base_model = tf.keras.models.load_model(str(test_keras_model))
+ base_model = keras.models.load_model(str(test_keras_model))
train_model(base_model)
base_tflite_metrics = _get_tflite_metrics(