s=mnist.train.next_batch(batch_size)
print(xs.shape)
print(ys.shape)
# #从集合中取全部变量
# tf.get_collection()
# #列表内对应元素相加
# tf.add_n([])
# #转换类型
# tf.cast(x,dtype=)
# #返回最大值所在的序列好
# tf.argmax(x,axis)
# #添加路径
# import os
# os.path.join("home","name")
# #字符串操作split()
# "./model/momist_model-1001".split("/")[-1].split("-")[-1]
# #模型保存
# saver=tf.train.Saver()
# with tf.Session() as sess:
# for i in range(steps):
# if i%轮数==0:
# saver.save(sess,os.path.join(MODEL,NAME),global=global_step)
# #加载模型
# with tf.Session() as sess:
# ckpt=tf.train.get_checkpoint_state(存储路径)
# if ckpt andckpt.model_path:
# saver.restore(sess,ckpt.model_path)
# #实例化还原滑动pingjun
# ema=tf.train.ExponentialMovingAverage(滑动平均基础)
# ema_restore=ema.variable_to_restore()
# saver=tf.train.Saver(ema_restore)
# #准确率计算方法
# correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(y_,1))
# accurcy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32))
#保存和加载模型
Saver=tf.train.Saver()
#保存模型
Saver.save(sess,save_path="C:/Users/Administrator/Desktop/mnist_tensorflow/model/save_net.ckpt")
#加载模型
saver = tf.train.import_meta_graph('C:/Users/Administrator/Desktop/mnist_tensorflow/model/save_net.ckpt.meta')
saver.restore(sess, "C:/Users/Administrator/Desktop/mnist_tensorflow/model/save_net.ckpt")