Skip to content

Commit 2c76a9f

Browse files
committed
Merge pull request nlintz#35 from DeepLearningProjects/unused_vars
Removed unused variable and make it work with 0.8
2 parents 728d42a + 08c152d commit 2c76a9f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

9_tensorboard.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ def init_weights(shape, name):
1010
# This network is the same as the previous one except with an extra hidden layer + dropout
1111
def model(X, w_h, w_h2, w_o, p_keep_input, p_keep_hidden):
1212
# Add layer name scopes for better graph visualization
13-
with tf.name_scope("layer1") as scope:
13+
with tf.name_scope("layer1"):
1414
X = tf.nn.dropout(X, p_keep_input)
1515
h = tf.nn.relu(tf.matmul(X, w_h))
16-
with tf.name_scope("layer2") as scope:
16+
with tf.name_scope("layer2"):
1717
h = tf.nn.dropout(h, p_keep_hidden)
1818
h2 = tf.nn.relu(tf.matmul(h, w_h2))
19-
with tf.name_scope("layer3") as scope:
19+
with tf.name_scope("layer3"):
2020
h2 = tf.nn.dropout(h2, p_keep_hidden)
2121
return tf.matmul(h2, w_o)
2222

@@ -39,21 +39,21 @@ def model(X, w_h, w_h2, w_o, p_keep_input, p_keep_hidden):
3939
p_keep_hidden = tf.placeholder("float", name="p_keep_hidden")
4040
py_x = model(X, w_h, w_h2, w_o, p_keep_input, p_keep_hidden)
4141

42-
with tf.name_scope("cost") as scope:
42+
with tf.name_scope("cost"):
4343
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(py_x, Y))
4444
train_op = tf.train.RMSPropOptimizer(0.001, 0.9).minimize(cost)
4545
# Add scalar summary for cost
4646
tf.scalar_summary("cost", cost)
4747

48-
with tf.name_scope("accuracy") as scope:
48+
with tf.name_scope("accuracy"):
4949
correct_pred = tf.equal(tf.argmax(Y, 1), tf.argmax(py_x, 1)) # Count correct predictions
5050
acc_op = tf.reduce_mean(tf.cast(correct_pred, "float")) # Cast boolean to float to average
5151
# Add scalar summary for accuracy
5252
tf.scalar_summary("accuracy", acc_op)
5353

5454
with tf.Session() as sess:
5555
# create a log writer. run 'tensorboard --logdir=./logs/nn_logs'
56-
writer = tf.train.SummaryWriter("./logs/nn_logs", sess.graph_def)
56+
writer = tf.train.SummaryWriter("./logs/nn_logs", sess.graph) # for 0.8
5757
merged = tf.merge_all_summaries()
5858

5959
# you need to initialize all variables

0 commit comments

Comments
 (0)