aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/nn/rewrite/library/fc_layer.py
blob: 2480500bd4f25283e63d37c9bcc05bcbf5e9bdae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# SPDX-FileCopyrightText: Copyright 2023, Arm Limited and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
"""Example rewrite with one fully connected layer."""
from typing import Any

import tensorflow as tf


def get_keras_model(input_shape: Any, output_shape: Any) -> tf.keras.Model:
    """Generate TensorFlow Lite model for rewrite."""
    model = tf.keras.Sequential(
        (
            tf.keras.layers.InputLayer(input_shape=input_shape),
            tf.keras.layers.Reshape([-1]),
            tf.keras.layers.Dense(output_shape),
        )
    )
    return model