Skip to content

Instantly share code, notes, and snippets.

@dniku
Created September 20, 2019 12:23
Show Gist options
  • Save dniku/2b344ac371bdc7c1c157f3933c9c5634 to your computer and use it in GitHub Desktop.
Save dniku/2b344ac371bdc7c1c157f3933c9c5634 to your computer and use it in GitHub Desktop.
import datetime
from pathlib import Path
from torch.utils.tensorboard import SummaryWriter
dt = datetime.datetime.now().isoformat(sep='_', timespec='milliseconds').replace(':', '-')
tb_dir = Path('tb') / dt
with SummaryWriter(str(tb_dir)) as writer:
writer.add_scalar('train/loss', 9001.0, 0)
writer.add_text('some/category', 'Hello world!', 1337)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment