Skip to content

Commit

Permalink
Minor update to debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed Mar 25, 2018
1 parent 3f15988 commit 46ce447
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions convoys/tf_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ def optimize(sess, target, placeholders, batch_size=1024, update_callback=None):
sess.run(optimizer, feed_dict=feed_dict)
cost += sess.run(target, feed_dict=feed_dict)

sys.stdout.write('step %6d (lr %6.6f): %14.3f%30s' % (step, learning_rate, cost, ''))
sys.stdout.write('\n' if step % 100 == 0 else '\r')
sys.stdout.flush()

if cost > best_cost:
best_cost, best_step = cost, step
if step - best_step > 20:
break
sys.stdout.write('step %6d (%6d since best): %14.3f%30s' % (step, step-best_step, cost, ''))
sys.stdout.write('\n' if step % 100 == 0 else '\r')
sys.stdout.flush()
step += 1

if update_callback:
Expand Down

0 comments on commit 46ce447

Please sign in to comment.