TensorBoard的使用

Tensorboard:

1、将tensorboard的event.out.tfevents.*文件放入log文件夹中;

2、进入log的前一级目录;

3、执行以下命令:

tensorboard --logdir=./log

4、在浏览器输入网址:http://localhost:6006,即可查看生成图。

 

Pytorch Tensorboard:

参考链接:https://www.jianshu.com/p/77f2c15572dc

pip install tensorboard, tensorboardX
import numpy as np
import torch
from tensorboardX import SummaryWriter

writer = Summary(log_dir='<your/running/dir>')

for n_iter in range(100):
    a = torch.rand(1)
    b = torch.rand(1)
    writer.add_scalar('data/scalar1', a[0], n_iter)
    writer.add_scalar('data/scalar2', b[0], n_iter)

    writer.add_scalar('data/scalar_group', {'xsinx': n_iter * np.sin(n_iter), 'xcosx': n_iter * np.cos(n_iter), 'arctanx': np.arctan(n_iter)}, n_iter)

writer.close()

 

posted on 2020-09-17 14:26  穷酸秀才大草包  阅读(283)  评论(0编辑  收藏  举报

导航