问题描述:
问题分析
安装的是TensorFlow2.0但是使用的是TensorFlow1.0版本的代码。
解决办法
- 把整个TensorFlow2.0的调用转换为TensorFlow1.0的调用,无需对单个函数就行修改。
#import tensorflow as tf #2021-11-03 tensorflow2.0 version
#2021-11-03 tensorflow 2.0 version using version 1.x method
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
- 不改变调用的TensorFlow的版本,对每个有问题的函数进行单独修改。
参考资料
ModuleNotFoundError:No module named ‘tensorflow.contrib’
tensorflow 2.0,神经网络:正弦拟合,AttributeError: module ‘tensorflow’ has no attribute 'placeholder’错误
AttributeError: module ‘tensorflow’ has no attribute 'placeholder’问题
AttributeError: module ‘tensorflow‘ has no attribute ‘variable_scope‘
解决问题:module ‘tensorflow._api.v2.image‘ has no attribute ‘resize_bilinear‘