首先是训练模型保存模型
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 21 12:33:46 2018
@author: FDXK
"""
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
max_step = 1000
learning_rate = 0.001
dropout = 0.9
data_dir = 'MNIST_data'
log_dir = 'log'
mnist = input_data.read_data_sets(data_dir, one_hot = True)
sess = tf.InteractiveSession()
with tf.name_scope('input'):
x = tf.placeholder(tf.float32, [None,784], name = 'x_input')
print(x)
y_ = tf.placeholder(tf.float32, [None, 10], name = 'y_input')
print(y_)
with tf.name_scope('input_reshape'):
image_shaped_input = tf.reshape(x, [-1, 28, 28, 1])
tf.summary.image('input', image_shaped_input, 10)
def weight_variable(shape):
initial = tf.truncated_normal(shape, stddev = 0.1)
return tf.Variabl