Hello,
I have met such problem before. In my case, writer.flush() solved the problem but sometimes, eventhough several add_scalar have been done, it’s not possible to visualize the result.
Could the problem be in the loss argument in add_scalar since it should be a torch.tensor?
Maybe using loss.item() solves your issue ?
Cheers