Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'tensorflow.contrib' with tensorflow=2.0.0

I am using TensorFlow version=2.0.0 python version=3.7.3 I am trying to import the below statement

from tensorflow.contrib import rnn

And it gives error as Module 'tensorflow' has no attribute 'contrib' How can I resolve this?

like image 613
kriti Avatar asked Mar 27 '20 08:03

kriti


1 Answers

from tensor flow

https://www.tensorflow.org/guide/upgrade#compatibility_modules

Because of TensorFlow 2.x module deprecations (for example, tf.flags and tf.contrib), some changes can not be worked around by switching to compat.v1. Upgrading this code may require using an additional library (for example, absl.flags) or switching to a package in tensorflow/addons.

and as describe in this thread

tensorflow.contrib doesn't exist in 2.0.

https://github.com/tensorflow/tensorflow/issues/31350#issuecomment-518749548

like image 189
Naor Tedgi Avatar answered Sep 19 '22 04:09

Naor Tedgi