下列代码有一些不太明白的函数可以在W3Cschool中的TensorFlow官方文档https://www.w3cschool.cn/tensorflow_python/中查找。
如tf.reset_default_graph()函数https://www.w3cschool.cn/tensorflow_python/tensorflow_python-nmgf2idd.html
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/",one_hot=True)
tf.reset_default_graph()#tf.reset_default_graph函数用于清除默认图形堆栈并重置全局默认图形。
#搭建模型
x = tf.placeholder(tf.float32,[None,784])#mnist data 维度 28*28=784
y = tf.placeholde