Skip to content

Commit

Permalink
Merge pull request hunkim#50 from GzuPark/patch-27
Browse files Browse the repository at this point in the history
Update lab-13-3-mnist_save_restore.py
  • Loading branch information
kkweon authored Apr 2, 2017
2 parents d5c485e + aa66e8f commit 0725ccb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lab-13-3-mnist_save_restore.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Lab 7 Learning rate and Evaluation
# Lab 13 Saver and Restore
import tensorflow as tf
import random
import matplotlib.pyplot as plt
# import matplotlib.pyplot as plt
import os

from tensorflow.examples.tutorials.mnist import input_data
Expand Down Expand Up @@ -33,7 +33,7 @@

# weights & bias for nn layers
# http://stackoverflow.com/questions/33640581/how-to-do-xavier-initialization-on-tensorflow
with tf.variable_scope('layer1') as scope:
with tf.variable_scope('layer1'):
W1 = tf.get_variable("W", shape=[784, 512],
initializer=tf.contrib.layers.xavier_initializer())
b1 = tf.Variable(tf.random_normal([512]))
Expand All @@ -45,7 +45,7 @@
tf.summary.histogram("bias", b1)
tf.summary.histogram("layer", L1)

with tf.variable_scope('layer2') as scope:
with tf.variable_scope('layer2'):
W2 = tf.get_variable("W", shape=[512, 512],
initializer=tf.contrib.layers.xavier_initializer())
b2 = tf.Variable(tf.random_normal([512]))
Expand All @@ -56,7 +56,7 @@
tf.summary.histogram("bias", b2)
tf.summary.histogram("layer", L2)

with tf.variable_scope('layer3') as scope:
with tf.variable_scope('layer3'):
W3 = tf.get_variable("W", shape=[512, 512],
initializer=tf.contrib.layers.xavier_initializer())
b3 = tf.Variable(tf.random_normal([512]))
Expand All @@ -67,7 +67,7 @@
tf.summary.histogram("bias", b3)
tf.summary.histogram("layer", L3)

with tf.variable_scope('layer4') as scope:
with tf.variable_scope('layer4'):
W4 = tf.get_variable("W", shape=[512, 512],
initializer=tf.contrib.layers.xavier_initializer())
b4 = tf.Variable(tf.random_normal([512]))
Expand All @@ -78,7 +78,7 @@
tf.summary.histogram("bias", b4)
tf.summary.histogram("layer", L4)

with tf.variable_scope('layer5') as scope:
with tf.variable_scope('layer5'):
W5 = tf.get_variable("W", shape=[512, 10],
initializer=tf.contrib.layers.xavier_initializer())
b5 = tf.Variable(tf.random_normal([10]))
Expand Down Expand Up @@ -110,7 +110,7 @@
writer.add_graph(sess.graph)
global_step = 0

# Savor and Restore
# Saver and Restore
saver = tf.train.Saver()
checkpoint = tf.train.get_checkpoint_state(CHECK_POINT_DIR)

Expand Down

0 comments on commit 0725ccb

Please sign in to comment.