Created
June 26, 2018 17:23
-
-
Save phizaz/ed804b47d0a845a8f99718fff69bacab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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