SummaryWriter

Learn about what the SummaryWriter class does, and take a look at the functionality of two of its methods: add_graph and add_scalars.

Overview of SummaryWriter

It all starts with the creation of a SummaryWriter:

Press + to interact
# setting SummaryWriter up
writer = SummaryWriter('runs/test')

If we try printing this, we get the following output:

Press + to interact
# setting SummaryWriter up
writer = SummaryWriter('runs/test')
print(writer)

Since we told TensorBoard to look for logs inside the runs folder, it only makes sense to actually log to that folder. Moreover, to be able to distinguish between different experiments or models, we should also specify a sub-folder: test.





...

If we do not specify any folder, TensorBoard will default to runs/CURRENT_DATETIME_HOSTNAME, which is not such a great name if you are looking for your experiment results in the future.

So, it is recommended to try to name it in a more meaningful way like runs/test or runs/simple_linear_regression. It will then create a subfolder inside runs (the folder we specified when we started TensorBoard).

Even better, you should name it in a meaningful way, and a ...

Access this course and 1400+ top-rated courses and projects.