[RNN] LSTM - quantization issue
Hi @RuxandraRusu29 

Sorry for the delayed response.

I guess the quantization scale might be affected because of the input tensors during representative dataset calibration and  should not be a problem unless it's affecting the performance. I'm interested to know if it is ?

Thanks. This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you. This issue was closed because it has been inactive for 7 days since being marked as stale. Please reopen if you'd like to work on this further. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62256">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/62256">No</a>

1. System information

- Google Colab
- tensorflow version - 2.14.0

2. Code

I started from the following tutorial provided by tensorflow.

https://blog.tensorflow.org/2021/04/adaptive-framework-for-on-device-recommendation.html

The end goal was to create a quantized model that used the LSTM encoder.

The quantization code is as it follows:

```
def representative_data_gen():
    rep_dataset = input_pipeline.get_input_dataset(
        data_filepattern=FLAGS.training_data_filepattern,
        input_config=input_config,
        vocab_file_dir=FLAGS.vocab_dir,
        batch_size=100)
    print(rep_dataset)
   
    for data in rep_dataset:
      for i in range(100):
        yield (
          "serving_default", {
            "context_movie_genre" : data[0]["context_movie_genre"][i],
            "context_movie_id" : data[0]["context_movie_id"][i],
            "context_movie_rating" : data[0]["context_movie_rating"][i],
          }
      )
      return
 
  converter.optimizations = [tf.lite.Optimize.DEFAULT]
  converter.representative_dataset = representative_data_gen
  tflite_quant_model = converter.convert()
  tflite_quant_model_path = os.path.join(export_dir, 'model_quant.tflite')
  with tf.io.gfile.GFile(tflite_quant_model_path, 'wb') as f:
    f.write(tflite_quant_model)
```

3. Failure after conversion

The conversion is successful, but the generated model is wrong.

The interpreter supports the model, but I consider there is a problem with the quantization parameters.

![image](https://github.com/tensorflow/tensorflow/assets/83610798/4bb684e6-98d5-414f-aac7-f2422cc6fec0)

The quantization **scale** for **output_state_in** and the actual **output** is different. After consulting the source code I was not able to notice any difference in the way the 2 vectors are treated during evaluation, so I suspect there may be some issues with the conversion.

I attached the generated model and the LSTM cell that has the problem highlighted. 

[model_quant (3).zip](https://github.com/tensorflow/tensorflow/files/13189426/model_quant.3.zip)
