TensorFlow-Examples icon indicating copy to clipboard operation
TensorFlow-Examples copied to clipboard

import tensorflow.contrib.eager as tfe error

Open missleepless opened this issue 6 years ago • 5 comments

import tensorflow.contrib.eager as tfe

When I enter the above cmd in spyder3, I get the error of "ModuleNotFoundError: No module named 'tensorflow.contrib'". How can I solve this problem?

my System information:

  • TensorFlow version: tensorflow GPU 2.0.0
  • Python version: 3.6.9
  • Installed using virtualenv? pip? conda?: pip
  • CUDA/cuDNN version:10.0/7.4
  • GPU model and memory: gtx1060/3G

missleepless avatar Oct 16 '19 14:10 missleepless

Me too. I searched online and learned that Tensorflow 2.0 removes 'tensorflow.contrib'. I don't know what else I can do except lower the version to Tensorflow 1.9.

xiao-fang123 avatar Nov 20 '19 09:11 xiao-fang123

take it easy man, tf is fine without contrib

xiangmingcai avatar Jun 23 '20 16:06 xiangmingcai

Still getting this, perhaps the code should be updated for TF2?

Traceback (most recent call last):
  File "gradient_boosted_decision_tree.py", line 4, in <module>
    from tensorflow.contrib.boosted_trees.estimator_batch.estimator import GradientBoostedDecisionTreeClassifier
ModuleNotFoundError: No module named 'tensorflow.contrib'

LinuxPersonEC avatar Nov 09 '20 19:11 LinuxPersonEC

I am having the same problem.

LifeWorks avatar Apr 15 '21 20:04 LifeWorks

It says eager execution is enabled by default in TF 2.0. https://www.tensorflow.org/guide/eager

I guess you do not need to use the tfe anymore. Simply use the tf

LifeWorks avatar Apr 15 '21 20:04 LifeWorks