From 95b7fbc2512cc5b042c45bf09621b9e2eb38cac3 Mon Sep 17 00:00:00 2001 From: sia Date: Sat, 4 Nov 2017 16:47:01 -0700 Subject: [PATCH] each log file goes into its own timestamped directory. Making the runs comparable in TensorBoard --- tutorials/04-utils/tensorboard/logger.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tutorials/04-utils/tensorboard/logger.py b/tutorials/04-utils/tensorboard/logger.py index 1cb034a8..8bdcd4df 100644 --- a/tutorials/04-utils/tensorboard/logger.py +++ b/tutorials/04-utils/tensorboard/logger.py @@ -1,7 +1,10 @@ # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514 import tensorflow as tf import numpy as np -import scipy.misc +import scipy.misc +import time +import os.path + try: from StringIO import StringIO # Python 2.7 except ImportError: @@ -12,7 +15,7 @@ class Logger(object): def __init__(self, log_dir): """Create a summary writer logging to log_dir.""" - self.writer = tf.summary.FileWriter(log_dir) + self.writer = tf.summary.FileWriter(os.path.join(log_dir, time.strftime("%Y-%m-%d-%H-%M-%S"))) def scalar_summary(self, tag, value, step): """Log a scalar variable."""