generating multiple scalar graphs in a for loop will cause RuntimeError
Created by: typhoonzero
below are my code snippet to genrate the data:
# generate datas like train_losses as a dict
...
for mode, name, data, scalar in [("train_loss", "loss", train_losses, scalar_train),
("test_loss", "loss", test_losses, scalar_test),
("train_acc1", "acc1", train_acc1, scalar_train_acc1),
("test_acc1", "acc1", test_acc1, scalar_test_acc1),
("train_acc5", "acc5", train_acc5, scalar_train_acc5),
("test_acc5", "acc5", test_acc5, scalar_test_acc5)]:
with logger.mode(mode):
writer = logger.scalar("resnet50/%s"%name)
for k, v in data.iteritems():
writer.add_record(k, v)
Reports error:
Traceback (most recent call last):
File "gen_data.py", line 71, in <module>
main()
File "gen_data.py", line 64, in main
writer = logger.scalar(sname)
File "/usr/local/lib/python2.7/site-packages/visualdl/python/storage.py", line 228, in scalar
return type2scalar[type](tag)
RuntimeError: [/root/VisualDL/visualdl/storage/storage.cc:46]