上代码
from torch.utils.tensorboard import SummaryWriter
writer=SummaryWriter("log2")
for i in range(100):
writer.add_scalars('haha', {'Train':i*i*3+0.5}, i)
writer.add_scalars('haha', {'Test': i*i}, i)
writer.close()
#############################################
!!!是add_scalars而不是add_scalar
有一个s!
#############################################
否则报错:
NotImplementedError: Got <class ‘dict’>, but numpy array, torch tensor, or caffe2 blob name are expected.
运行截图
文章出处登录后可见!
已经登录?立即刷新