引入以下包时:
import tensorflow.contrib.layers as tf_layers
报错:
ModuleNotFoundError: No module named 'tensorflow.contrib'
问题原因:
TensorFlow2.0删除已经删除tensorflow.contrib包
解决方法:
方法一:TensorFlow降级
pip uninstall tensorflow
pip install tensorflow==1.14.0
由于我的python环境为python3.6,提示没有合适的版本。
方法二:TF-slim包
pip install --upgrade tf-slim
讲引入的包改为:
import tf_slim.layers as tf_layers