自编码实例1: MNIST
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/QFire/article/details/90437796 import tensorflow as tf import numpy as np import matplotlib.pyplot as plt # 导入 MINST 数据集 from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("/data/", one_hot=True) # 网络模型参数 learning_rate = 0.01 n_hidden_1 = 256 # 第一层256 n_hidden_2 = 128 # 第二层128 n_input = 784 x = tf.placeholder("float", [None, n_input]) y = x # 参数 weights = { "encoder_h1": tf.Variable(tf.random_normal([n_input, n_hidden_1])), "encoder_h2": tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2])), "decoder