A training loop can print a metric after each epoch, but a single number does not tell you whether performance is improving or whether the latest value is an outlier. TensorBoard turns logged training metrics into browser-based graphs so you can follow their trends. Although it originated with TensorFlow, it also works with PyTorch. section 13.9
To inspect an existing run:
- Install TensorBoard with `pip install tensorboard`, then start it with `tensorboard --logdir runs/`. Point `--logdir` at the directory containing your logged data. section 13.9.1
- Open `http://localhost:6006` in a browser. If training ran on another computer, use that computer’s hostname or IP address instead of `localhost`. section 13.9.1
- Select the Scalars tab to view metric graphs. Select the runs you want to compare; hiding other runs can make crowded graphs easier to read. section 13.9.1
Smoothing can make a noisy trend easier to see, but too much can hide important changes. The unsmoothed values remain visible as a faded line. TensorBoard also offers Histograms and precision–recall curves; the Distributions tab is not needed for this workflow. section 13.9.1
In PyTorch, `torch.utils.tensorboard.SummaryWriter` writes data for TensorBoard. Create separate writers for training and validation, reuse them across epochs, and give each a `log_dir` under `runs/`. Waiting until there is data to write avoids creating empty runs when an experiment crashes early. section 13.9.2
Log each computed metric
Once a writer exists, a metrics-logging loop can call `writer.add_scalar(key, value, self.totalTrainingSamples_count)` for each entry in `metrics_dict`. The metric name becomes its tag, while the training-sample count supplies the step. Early training values may be noisy; keep that in mind when reading the graph. section 13.9.2
Graphs are most useful when the metric measures what matters. A classifier trained on mostly negative samples can appear accurate while classifying every sample as negative. Graphing quality metrics such as precision and recall helps reveal performance that overall accuracy obscures. TensorBoard can also display generated 2D images over a training run to track changes in model output. section 14.0 section 15.11

