Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (24 sloc) 765 Bytes
import os
import shutil
from tensorboard.summary import scalar
from tensorboard import FileWriter
def test_event_logging():
logdir = './experiment/'
summary_writer = FileWriter(logdir)
scalar_value = 1.0
s = scalar('test_scalar', scalar_value)
summary_writer.add_summary(s, global_step=1)
summary_writer.close()
assert os.path.isdir(logdir)
assert len(os.listdir(logdir)) == 1
summary_writer = FileWriter(logdir)
scalar_value = 1.0
s = scalar('test_scalar', scalar_value)
summary_writer.add_summary(s, global_step=1)
summary_writer.close()
assert os.path.isdir(logdir)
assert len(os.listdir(logdir)) == 2
# clean up.
shutil.rmtree(logdir)
if __name__ == "__main__":
test_event_logging()
You can’t perform that action at this time.