summary_writer = tf.train.SummaryWriter('experiment', graph=sess.graph) if os.path.isfile("save/model.ckpt"): print("Restoring saved parameters") saver.restore(sess, "save/model.ckpt") else: print("Initializing parameters") sess.run(tf.initialize_all_variables()) print("Initializing parameters") sess.run(tf.initialize_all_variables()) for step in xrange(1, n_steps): batch = rd.get_next_batch(batch_size=batch_size) feed_dict = {x: batch} _, cur_loss, summary_str = sess.run([train_step, loss, summary_op], feed_dict=feed_dict) summary_writer.add_summary(summary_str, step) if step % 50 == 0: print "Step {0} | Loss: {1}".format(step, cur_loss) # check if the model works for i in xrange(5): image = rd.get_one_image() rd.show_a_image(image) image = np.reshape(image, newshape=[1, 1024]) feed_dict = {x: image} x_hatt = sess.run(x_hat, feed_dict=feed_dict) rd.show_a_image(x_hatt)