Skip to content

Commit

Permalink
Added subdirectory structure to logs dir so that different runs can b…
Browse files Browse the repository at this point in the history
…e visualized in tensorboard
  • Loading branch information
gabrieleangeletti committed May 15, 2016
1 parent fc7bf79 commit 61985d7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion model.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,18 @@ def _initialize_tf_utilities_and_ops(self, restore_previous_model):
if restore_previous_model:
self.tf_saver.restore(self.tf_session, self.model_path)

self.tf_summary_writer = tf.train.SummaryWriter(self.tf_summary_dir, self.tf_session.graph)
# Retrieve run identifier
run_id = 0
for e in os.listdir(self.tf_summary_dir):
if e[:3] == 'run':
r = int(e[3:])
if r > run_id:
run_id = r
run_id += 1
run_dir = os.path.join(self.tf_summary_dir, 'run' + str(run_id))
print('Tensorboard logs dir for this run is %s' % (run_dir))

self.tf_summary_writer = tf.train.SummaryWriter(run_dir, self.tf_session.graph)

def _initialize_training_parameters(self, loss_func, learning_rate, num_epochs, batch_size,
dataset, opt, dropout=1, momentum=None, l2reg=None):
Expand Down

0 comments on commit 61985d7

Please sign in to comment.