Skip to content

Commit 02ef6b6

Browse files
authored
Merge pull request #159 from Nandayang/master
update utils.py when not val
2 parents e18dd1c + 460a1de commit 02ef6b6

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tensorlayer/utils.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,15 @@ def fit(sess, network, train_op, cost, X_train, y_train, x, y_, acc=None, batch_
130130
result = sess.run(merged, feed_dict=feed_dict)
131131
train_writer.add_summary(result, tensorboard_train_index)
132132
tensorboard_train_index += 1
133-
134-
for X_val_a, y_val_a in iterate.minibatches(
133+
if (X_val is not None) and (y_val is not None):
134+
for X_val_a, y_val_a in iterate.minibatches(
135135
X_val, y_val, batch_size, shuffle=True):
136-
dp_dict = dict_to_one( network.all_drop ) # disable noise layers
137-
feed_dict = {x: X_val_a, y_: y_val_a}
138-
feed_dict.update(dp_dict)
139-
result = sess.run(merged, feed_dict=feed_dict)
140-
val_writer.add_summary(result, tensorboard_val_index)
141-
tensorboard_val_index += 1
136+
dp_dict = dict_to_one( network.all_drop ) # disable noise layers
137+
feed_dict = {x: X_val_a, y_: y_val_a}
138+
feed_dict.update(dp_dict)
139+
result = sess.run(merged, feed_dict=feed_dict)
140+
val_writer.add_summary(result, tensorboard_val_index)
141+
tensorboard_val_index += 1
142142

143143
if epoch + 1 == 1 or (epoch + 1) % print_freq == 0:
144144
if (X_val is not None) and (y_val is not None):

0 commit comments

Comments
 (0)