How to get a LSTM Layer in Tensorflow Lite?

Viewed 149

I trained a simple model with Keras:

model = tf.keras.models.Sequential([tf.keras.layers.LSTM(20,
  time_major=False, unroll=False, input_shape=(28,28)), 
  tf.keras.layers.Dense(10, activation=tf.nn.softmax, name='output')])

Then, I converted my model with TfLite:

converter = tf.lite.TFLiteConverter.from_saved_model("mnist_lstm_model")
converter.experimental_new_converter = True
tflite_model = converter.convert()

I obtain a UNIDIRECTIONNAL_SEQUENCE_LSTM layer instead of LSTM. But I really need a LSTM layer for inference.

Thank you!

0 Answers
Related