简体   繁体   中英

module tensorflow has no attribute contrib

I've made a piece of code using a tutorial based on tensorflow 1.6 which uses 'contrib' and this is not compatible with my current tensorflow verison (2.1.0).

I haven't been able to run the upgrade script and downgrading my version of tf causes another host of problems.

I've also tried using other modules in tensor flow 2 such as tensorflow-addons and disabling version 2 behaviour.

What to do??

Thank you to @jdehesa

Here is the information on TensorFlow official website.

Warning: The tf.contrib module is not included in TensorFlow 2. Many of its submodules have been integrated into TensorFlow core, or spun-off into other projects like tensorflow_io, or tensorflow_addons. For instructions on how to upgrade see the Migration guide.

https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib

https://www.tensorflow.org/guide/migrate

Or, you can just convert the code to an appropriate version for TF 2.x.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM