一、报错截图:

二、报错原因:TensoFlow2.0版本没有placeholder这个属性
三、解决方法:
在代码里添加下面这行代码
tf.compat.v1.disable_eager_execution()
原先的:
X = tf.placeholder("float")
Y = tf.placeholder("float")
修改为:
X = tf.compat.v1.placeholder("float")
Y = tf.compat.v1.placeholder("float")
就可以了~