Tensorboard (experimental) in PyTorch 1.1

Akash Raj
1 min readMay 4, 2019

--

In the latest release (v1.1), PyTorch officially introduced the much-loved visualization tool, Tensorboard. Although it is an experimental version and might change in the near future, I think this is awesome.

Upgrade PyTorch version 1.0.x

pip install --upgrade torch

Install Tensorboard

pip install tb-nightly

That’s it. You are good to go. Import the SummaryWriter and begin visualization :)

from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter(log_dir='./logs')# Track variables (e.g. loss, kld, etc.) that change
writer.add_scalar('KL Divergence', kl_div)
writer.add_scalar('Total Loss', loss)
writer.add_text('Decoder output', 'Some output')

To view the output, in terminal execute the following,

tensorboard --logdir=logs

Fire up your browser and point to http://127.0.0.1:6006

PyTorch 1.1 with Tensorboard ❤

For details, check out the documentation.

--

--

Akash Raj

Artificial Intelligence Researcher | Developer