(一)
输入:
x = tf.placeholder("float",shape = [None,784])
y = tf.placeholder("float",shape = [None,10])
结果报错:
AttributeError: module 'tensorflow' has no attribute 'placeholder'
解决办法:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
原因分析:
Tensorflow 1.x 版本提供placeholder,2.0版本的代码就不能执行。这个代码的意义也就在2.x版本的tensorflow环境就执行一下1.x版本的tensorflow代码。