Quantizing LSTM layers?

There seems to no support available for LSTM layer quantization.
If one has to do Quantization of LSTM layers, what will be starting point ?

1 Like

Hi, I think you can starts from Post training quantization : 훈련 후 양자화  |  TensorFlow Lite

Unfortunately, Quantization aware training is not supports LSTM/RNN layers yet.
(It just in the plan.)

For your information, There’s known issue related to LSTM quantization: Can LSTM be fully quantized for inference? · Issue #25563 · tensorflow/tensorflow · GitHub

3 Likes

You can also check

2 Likes

Hi, I’ve the same problem :
RuntimeError: Layer lstm:<class ‘keras.src.layers.rnn.lstm.LSTM’> is not supported. You can quantize this layer by passing a tfmot.quantization.keras.QuantizeConfig instance to the quantize_annotate_layer API.

Tf version : 2.14.1
Today, is the LSTM layer supported by QAT ? If yes, which version of Tf do I need ?
Ty

Unfortunately, this is still not supported. And we don’t have plans to add this support in the near future.