I am trying to use a Keras model saved in tflite in C#. For preformance constraints, I would like to have a 1D array as an input to my model.
But Keras always seems to add a dimension before for the batch size:
import tensorflow as tf
input_layer = tf.keras.layers.Input(128)
Model: "model_2"
__________________________________________________________________________________________________
Layer (type) Output Shape Param # Connected to
==================================================================================================
input_1 (InputLayer) [(None, 128)] 0
I then export it to tflite using the following:
converter = tf.lite.TFLiteConverter.from_keras_model(keras_model)
model_lite = converter.convert()
with open("model.tflite", "wb") as f:
f.write(model_lite)
When I upen my tflite model, the dimension is (1, 128) I haven't found a way to make it 128
Here it is None, I can set it to 1 but the first dimension remains, I am not sure how to discard it, there seems to be no way to do this in the tensorflow documentation.
I use: tensorflow-2.6.5 and python 3.7.5