I am a newbie in tensorflow, just started a week ago. I was trying to run tf.contrib.slim
, however, I was told that "AttributeError: module 'tensorflow' has no attribute 'contrib'"
. Anyone has solved this problem before and lend me a help? Thank you very much!
Asked
Active
Viewed 161 times
0

Jamiu S.
- 5,257
- 5
- 12
- 34
1 Answers
0
tf.contrib
has moved out of TF starting TF 2.0 alpha.
This question was already answered by @mlneural03
More information can be found under the original question: Module 'tensorflow' has no attribute 'contrib'
The Tensorflow 2.0 release notes: https://github.com/tensorflow/tensorflow/releases/tag/v2.0.0-alpha0
In the linked post it is also explained how to get around this issue on Tensorflow 2.x+. This (for example) is a way to automatically upgrade your code from TF1 to TF2:
$tf_upgrade_v2 \
--intree my_project/ \
--outtree my_project_v2/ \
--reportfile report.txt
The equivalent to tf.contrib
would be tf.compat.v1.estimator
.

Eric Dirla
- 81
- 7
-
Yes, im able to solve the prob. Thank you! – JING ZONG YAP Sep 13 '22 at 03:45