pytorch 中用tensorboard 可视化

Step1:

  假设已经安装了tensorflow

  • 安装tensorboard: pip install tensorboard
  • 安装tensorboardX:可通过pip install tensorboardX命令直接安装。

Step2:使用举例

import numpy as np 
from tensorboardX import SummaryWriter
writer=SummaryWriter('yourfolder') 
for epoch in range(100): 
         writer.add_scalar('scalar/test',np.random.rand(),epoch)         

         writer.add_scalars('scalar/scalars_test',{'xsinx':epoch*np.sin(epoch), \
'xcosx':epoch*np.cos(epoch)},epoch) 
writer.close() 

Stp3:查看方法

       首先终端: tensordboard --logdir=yourfolder

        打开浏览器: 输入:http://localhost:6006

参考:https://www.jianshu.com/p/46eb3004beca

展开阅读全文

没有更多推荐了,返回首页