aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/nn/rewrite
diff options
context:
space:
mode:
Diffstat (limited to 'src/mlia/nn/rewrite')
-rw-r--r--src/mlia/nn/rewrite/core/rewrite.py1
-rw-r--r--src/mlia/nn/rewrite/library/fc_clustering_layer.py13
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mlia/nn/rewrite/core/rewrite.py b/src/mlia/nn/rewrite/core/rewrite.py
index 4fe1c26..a8084e8 100644
--- a/src/mlia/nn/rewrite/core/rewrite.py
+++ b/src/mlia/nn/rewrite/core/rewrite.py
@@ -157,6 +157,7 @@ class RewritingOptimizer(Optimizer):
[
FullyConnectedRewrite("fully-connected", fc_rewrite),
Sparsity24Rewrite("fully-connected-sparsity24", fc_rewrite_sparsity24),
+ FullyConnectedRewrite("fully-connected-clustering", fc_rewrite),
]
)
diff --git a/src/mlia/nn/rewrite/library/fc_clustering_layer.py b/src/mlia/nn/rewrite/library/fc_clustering_layer.py
new file mode 100644
index 0000000..07c07ac
--- /dev/null
+++ b/src/mlia/nn/rewrite/library/fc_clustering_layer.py
@@ -0,0 +1,13 @@
+# 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
+
+from keras.api._v2 import keras # Temporary workaround for now: MLIA-1107
+
+from mlia.nn.rewrite.library.fc_layer import get_keras_model
+
+
+def get_keras_model_clus(input_shape: Any, output_shape: Any) -> keras.Model:
+ """Generate TensorFlow Lite model for clustering rewrite."""
+ return get_keras_model(input_shape, output_shape)