文档似乎表明add_custom_scalars_multilinechart可以执行此操作,但无法正常工作。
具有这样的内容:
from tensorboardX import SummaryWriter
writer = SummaryWriter(comment='test')
writer.add_custom_scalars_multilinechart(['loss/train', 'loss/test'], title='losses')
for blahblah:
...
writer.add_scalar('loss/train', loss.item(), epoch)
writer.add_scalar('loss/test', loss_test.item(), epoch)
答案 0 :(得分:1)
from tensorboardX import SummaryWriter
为两个标量创建两个summaryWriter
writer_train = SummaryWriter('runs/train_0')
writer_test = SummaryWriter('runs/test_0')
将标量实例添加到相应的summaryWriter中;它们必须具有相同的标签,例如:“ LOSS”
for data in loop:
writer_train.add_scalar('LOSS', loss.data.item(), idx)
writer_test.add_scalar('LOSS', loss_test.data.item(), idx)
有关工作代码,请访问github:Examples with tensorboardX (请参阅more_plots_one_chat.py)
教程:TensorboardX