aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/nn/rewrite/library/fc_clustering_layer.py
diff options
context:
space:
mode:
authorNathan Bailey <nathan.bailey@arm.com>2024-05-07 13:46:39 +0100
committerNathan Bailey <nathan.bailey@arm.com>2024-05-21 16:51:15 +0100
commit0d3cc76284f9311c99169b568570d767f5b0aeb6 (patch)
tree2f187e003db300a61e91759040d867c568cca2c8 /src/mlia/nn/rewrite/library/fc_clustering_layer.py
parentfa1bf7cde005283eb8ef195ada4af48b31ff043e (diff)
downloadmlia-0d3cc76284f9311c99169b568570d767f5b0aeb6.tar.gz
feat: CLI and API changes for the conv2d rewrites
Implements CLI and API changes for the new conv2d rewrite targets Resolves: MLIA-1157 Signed-off-by: Nathan Bailey <nathan.bailey@arm.com> Change-Id: I03c7a3a536d2f0a805b4689a9d96b95f8b4ab86c
Diffstat (limited to 'src/mlia/nn/rewrite/library/fc_clustering_layer.py')
-rw-r--r--src/mlia/nn/rewrite/library/fc_clustering_layer.py26
1 files changed, 0 insertions, 26 deletions
diff --git a/src/mlia/nn/rewrite/library/fc_clustering_layer.py b/src/mlia/nn/rewrite/library/fc_clustering_layer.py
deleted file mode 100644
index 7cc383e..0000000
--- a/src/mlia/nn/rewrite/library/fc_clustering_layer.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# SPDX-FileCopyrightText: Copyright 2024, Arm Limited and/or its affiliates.
-# SPDX-License-Identifier: Apache-2.0
-"""Example rewrite with one fully connected clustered layer."""
-from typing import Any
-
-import tensorflow_model_optimization as tfmot
-from keras.api._v2 import keras # Temporary workaround for now: MLIA-1107
-
-
-def get_keras_model_clus(input_shape: Any, output_shape: Any) -> keras.Model:
- """Generate TensorFlow Lite model for clustering rewrite."""
- rewrite_params = {
- "number_of_clusters": 32,
- "cluster_centroids_init": tfmot.clustering.keras.CentroidInitialization.LINEAR,
- }
- model = tfmot.clustering.keras.cluster_weights(
- to_cluster=keras.Sequential(
- [
- keras.layers.InputLayer(input_shape=input_shape),
- keras.layers.Flatten(),
- keras.layers.Dense(units=output_shape),
- ]
- ),
- **rewrite_params
- )
- return model