学习深度学习时,使用 tensorflow 是必不可少的,但是在导入tensorflow中的模块时遇到很多问题,下面对几种常见的问题提供解决方法:
1.导入 mnist 数据集
解决方法:
2.tensorflow显示没有placeholder、random_normal等模块
此问题说明你的tensorflow版本太高
import tensorflow as tf
print(tf.__version__) # 查看 tensorflow 版本
解决方法:
import tensorflow._api.v2.compat.v1 as tf
tf.disable_v2_behavior()