Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def draw_line(vis, step, lines, names):
- # draw multiple lines in one panel.
- """
- :param vis: the object of the visdom.Visdom
- :param step: the step of the line
- :param lines: the lines tuple, (line1, line2, ...)
- :param names: the names tuple, (name1, name2, ...)
- :return: None
- """
- if not len(lines) == len(names):
- raise ValueError('The length of the input is not the same')
- win_name = ''
- for i in range(len(names)):
- win_name += names[i]
- if step == 0:
- for line, name in zip(lines, names):
- vis.line(X=torch.Tensor([step]),
- Y=torch.Tensor([line]),
- win=win_name,
- name='%s' % name,
- opts=dict(legend=[name])
- )
- else:
- for line, name in zip(lines, names):
- vis.updateTrace(X=torch.Tensor([step]),
- Y=torch.Tensor([line]),
- win=win_name,
- name='%s' % name
- )
Add Comment
Please, Sign In to add comment