aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py8
-rw-r--r--tests/test_devices_ethosu_advice_generation.py4
-rw-r--r--tests/test_nn_tensorflow_config.py11
-rw-r--r--tests/test_nn_tensorflow_tflite_metrics.py6
-rw-r--r--tests/test_nn_tensorflow_utils.py4
5 files changed, 17 insertions, 16 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 1cb3dcd..b1f32dc 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -176,23 +176,23 @@ def fixture_test_keras_model(test_models_path: Path) -> Path:
@pytest.fixture(scope="session", name="test_tflite_model")
def fixture_test_tflite_model(test_models_path: Path) -> Path:
- """Return test TFLite model."""
+ """Return test TensorFlow Lite model."""
return test_models_path / "test_model.tflite"
@pytest.fixture(scope="session", name="test_tflite_vela_model")
def fixture_test_tflite_vela_model(test_models_path: Path) -> Path:
- """Return test Vela-optimized TFLite model."""
+ """Return test Vela-optimized TensorFlow Lite model."""
return test_models_path / "test_model_vela.tflite"
@pytest.fixture(scope="session", name="test_tf_model")
def fixture_test_tf_model(test_models_path: Path) -> Path:
- """Return test TFLite model."""
+ """Return test TensorFlow Lite model."""
return test_models_path / "tf_model_test_model"
@pytest.fixture(scope="session", name="test_tflite_invalid_model")
def fixture_test_tflite_invalid_model(test_models_path: Path) -> Path:
- """Return test invalid TFLite model."""
+ """Return test invalid TensorFlow Lite model."""
return test_models_path / "invalid.tflite"
diff --git a/tests/test_devices_ethosu_advice_generation.py b/tests/test_devices_ethosu_advice_generation.py
index 5a49089..21a3667 100644
--- a/tests/test_devices_ethosu_advice_generation.py
+++ b/tests/test_devices_ethosu_advice_generation.py
@@ -444,7 +444,7 @@ def test_ethosu_advice_producer(
Advice(
[
"For better performance, make sure that all the operators "
- "of your final TFLite model are supported by the NPU.",
+ "of your final TensorFlow Lite model are supported by the NPU.",
]
)
],
@@ -456,7 +456,7 @@ def test_ethosu_advice_producer(
Advice(
[
"For better performance, make sure that all the operators "
- "of your final TFLite model are supported by the NPU.",
+ "of your final TensorFlow Lite model are supported by the NPU.",
"For more details, run: mlia operators --help",
]
)
diff --git a/tests/test_nn_tensorflow_config.py b/tests/test_nn_tensorflow_config.py
index 1ac9f97..1a6fbe3 100644
--- a/tests/test_nn_tensorflow_config.py
+++ b/tests/test_nn_tensorflow_config.py
@@ -14,7 +14,7 @@ from mlia.nn.tensorflow.config import TfModel
def test_convert_keras_to_tflite(tmp_path: Path, test_keras_model: Path) -> None:
- """Test Keras to TFLite conversion."""
+ """Test Keras to TensorFlow Lite conversion."""
keras_model = KerasModel(test_keras_model)
tflite_model_path = tmp_path / "test.tflite"
@@ -25,7 +25,7 @@ def test_convert_keras_to_tflite(tmp_path: Path, test_keras_model: Path) -> None
def test_convert_tf_to_tflite(tmp_path: Path, test_tf_model: Path) -> None:
- """Test TensorFlow saved model to TFLite conversion."""
+ """Test TensorFlow saved model to TensorFlow Lite conversion."""
tf_model = TfModel(test_tf_model)
tflite_model_path = tmp_path / "test.tflite"
@@ -47,7 +47,8 @@ def test_convert_tf_to_tflite(tmp_path: Path, test_tf_model: Path) -> None:
pytest.raises(
Exception,
match="The input model format is not supported"
- r"\(supported formats: TFLite, Keras, TensorFlow saved model\)!",
+ r"\(supported formats: TensorFlow Lite, Keras, "
+ r"TensorFlow saved model\)!",
),
),
],
@@ -55,7 +56,7 @@ def test_convert_tf_to_tflite(tmp_path: Path, test_tf_model: Path) -> None:
def test_get_model_file(
model_path: str, expected_type: type, expected_error: Any
) -> None:
- """Test TFLite model type."""
+ """Test TensorFlow Lite model type."""
with expected_error:
model = get_model(model_path)
assert isinstance(model, expected_type)
@@ -67,6 +68,6 @@ def test_get_model_file(
def test_get_model_dir(
test_models_path: Path, model_path: str, expected_type: type
) -> None:
- """Test TFLite model type."""
+ """Test TensorFlow Lite model type."""
model = get_model(str(test_models_path / model_path))
assert isinstance(model, expected_type)
diff --git a/tests/test_nn_tensorflow_tflite_metrics.py b/tests/test_nn_tensorflow_tflite_metrics.py
index ca4ab55..0e4c79c 100644
--- a/tests/test_nn_tensorflow_tflite_metrics.py
+++ b/tests/test_nn_tensorflow_tflite_metrics.py
@@ -53,7 +53,7 @@ def _sparse_binary_keras_model() -> tf.keras.Model:
@pytest.fixture(scope="class", name="tflite_file")
def fixture_tflite_file() -> Generator:
- """Generate temporary TFLite file for tests."""
+ """Generate temporary TensorFlow Lite file for tests."""
converter = tf.lite.TFLiteConverter.from_keras_model(_sparse_binary_keras_model())
tflite_model = converter.convert()
with tempfile.TemporaryDirectory() as tmp_dir:
@@ -64,7 +64,7 @@ def fixture_tflite_file() -> Generator:
@pytest.fixture(scope="function", name="metrics")
def fixture_metrics(tflite_file: str) -> TFLiteMetrics:
- """Generate metrics file for a given TFLite model."""
+ """Generate metrics file for a given TensorFlow Lite model."""
return TFLiteMetrics(tflite_file)
@@ -74,7 +74,7 @@ class TestTFLiteMetrics:
@staticmethod
def test_sparsity(metrics: TFLiteMetrics) -> None:
"""Test sparsity."""
- # Create new instance with a sample TFLite file
+ # Create new instance with a sample TensorFlow Lite file
# Check sparsity calculation
sparsity_per_layer = metrics.sparsity_per_layer()
for name, sparsity in sparsity_per_layer.items():
diff --git a/tests/test_nn_tensorflow_utils.py b/tests/test_nn_tensorflow_utils.py
index 6d27299..199c7db 100644
--- a/tests/test_nn_tensorflow_utils.py
+++ b/tests/test_nn_tensorflow_utils.py
@@ -15,7 +15,7 @@ from mlia.nn.tensorflow.utils import save_tflite_model
def test_convert_to_tflite(test_keras_model: Path) -> None:
- """Test converting Keras model to TFLite."""
+ """Test converting Keras model to TensorFlow Lite."""
keras_model = tf.keras.models.load_model(str(test_keras_model))
tflite_model = convert_to_tflite(keras_model)
@@ -34,7 +34,7 @@ def test_save_keras_model(tmp_path: Path, test_keras_model: Path) -> None:
def test_save_tflite_model(tmp_path: Path, test_keras_model: Path) -> None:
- """Test saving TFLite model."""
+ """Test saving TensorFlow Lite model."""
keras_model = tf.keras.models.load_model(str(test_keras_model))
tflite_model = convert_to_tflite(keras_model)