1.引入头文件,创建网络模型及定义学习参数的变量
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/data/", one_hot=True)
train_X = mnist.train.images
train_Y = mnist.train.labels
test_X = mnist.test.images
test_Y = mnist.test.labels
n_input = 784
n_hidden_1 = 256
#占位符
x = tf.placeholder("float", [None, n_input])
y = tf.placeholder("float", [None, n_input])
dropout_keep_prob = tf.placeholder("float")
#学习参数
weights = {'h1':tf.Variable(tf.random_normal([n_input, n_hidden_1])),
'h2':tf.Variable(tf.random_normal([n_hidden_1, n_hidden_1])),
'out':tf.Variable(tf.random_normal([n_hidden_1, n_input]))}
biases = {'b1':tf.Variable(tf.zeros([n_hidden_1])),
'b2':