Skip to content

Instantly share code, notes, and snippets.

@phizaz
Created June 26, 2018 17:23
Show Gist options
  • Save phizaz/ed804b47d0a845a8f99718fff69bacab to your computer and use it in GitHub Desktop.
Save phizaz/ed804b47d0a845a8f99718fff69bacab to your computer and use it in GitHub Desktop.
import tensorflow.contrib.summary as summary
global_step = tf.train.get_or_create_global_step()
optimizer = tf.train.AdamOptimizer(lr).minimize(..., global_step=global_step)
writer = summary.create_file_writer('log')
writer.set_as_default()
summary.always_record_summaries()
with summary.record_summaries_every_n_global_steps(1):
with tf.name_scope('metrices'):
summary.scalar('loss', loss)
summary.scalar('acc', acc)
summary.initialize(graph=tf.get_default_graph())
while True:
try:
sess.run([
...,
summary.all_summary_ops()
])
except tf.errors.OutOfRangeError:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment