Tensorboard fails to plot model weights for all epochs during training

I am trying to plot the progression of my model’s weights during training using add_scalar, however, the tensorboard plot only shows the weights for any one epoch.

What I mean by this is, when I load tensorboard, I only see “epoch 0” in the scalars section even if I have run my model for 10 epochs. However, I dont have this issue while plotting histograms in the same code.

My code is as follows:

for epoch in total_epochs:
          train model
          calculate error
          optimizer.step()
          calculate average loss
          
          for name,weight in model.named_parameters():
              SummaryWriter.add_histogram(name, weight, epoch)
              SummaryWriter.add_scalar(str(name), weight, epoch)

Here is an example of what I mean. I had run the model for 10 epochs, the graph only shows epoch 0 and 1. However, the histogram (not pictured) contains the progression of all 10 epochs.

For custom training loops and TensorBoard, have you tried the method described in Using TensorBoard with other methods (tf.summary)?