I am currently using this notebook: GitHub - roemmele/keras-rnn-notebooks: Python notebooks that demonstrate simple RNN models for NLP tasks using Keras

As far as I know, this notebook worked with tensorflow==2.3.1. Now I have make this notebook work with tensorflow==2.15.0. The problem I have encountered is this.

I see the problem occurs when the input tensor passes the hidden layer in the model. The model is this.

How can I fix the problem? Do I have to use tf.while_loop’s shape_invariant parameter? Is there anyway not using tf.while_loop? Lowering the tensorflow version is not a given choice for me.

Thank you for reading this topic.