Corresponding function in TFv2.x.x

Hi all, I am new to tensorflow.

There is this function related to LSTMs which is written in tf.contrib in the 1.x.x versions of tensorflow - tf.contrib.rnn.CoupledInputForgetGateLSTMCell  |  TensorFlow Core v1.15.0

I am not able to find the corresponding function in tensorflow 2.x.x. I also tried doing tf.compat.v1.contrib.rnn.CoupledInputForgetGateLSTMCell() but I am getting the following error -
AttributeError: module 'tensorflow._api.v2.compat.v1' has no attribute 'contrib'

More generally, where are the functions in tf.contrib located in tensorflow 2?

Any help will be greatly appreciated.


I think you can learn a little bit the history of the tf.contrib at:

1 Like

Thank you so much for your response @Bhack and apologies for my late reply. I will read the post and get back if I have any questions.

Have you checked tfa.rnn.LayerNormLSTMCell for your case?
It is a part of TF Addons package which is compatible with TF 2.X versions
(TF Addons package contains a subset tf.contrib* functionality)

Hi @Yasir_Modak, thanks. I’ll check out tf add-ons. Is tfa.rnn.LayerNormLSTMCell same as CoupledInputForgetGateLSTMCell() though?
Thanks again.