In python, I'm logging tensorflow scalar values with:
import tensorflow as tf
...
self.writer = tf.summary.FileWriter(log_dir)
...
summary = tf.Summary(
value=[
tf.Summary.Value(
tag=tag,
simple_value=value
)
]
)
self.writer.add_summary(summary, step)
self.writer.flush()
I would like to be able to continue my logging where I last left off.
How would I now import the log files and read out the last value and its index?
Something like that might work:
def get_latest_value(log_file, tag_name):
latest_summ = None
latest_value = None
for summary in tf.train.summary_iterator(log_file):
if latest_summ is None or summary.step > latest_summ.step:
latest_summ = summary
for v in latest_summ.summary.value:
if v.tag == tag_name:
return v.simple_value
get_latest_value("./log/events.out.tfevents.1554114440.me", "train_error")