Pytorch中使用tensorboard学习笔记(5) 添加条形图add_histogram

参考链接: add_histogram
代码:

from torch.utils.tensorboard import SummaryWriter
import numpy as np
writer = SummaryWriter()
for i in range(5):  # 8
    x = np.random.random(1000000) # 1000
    writer.add_histogram('林麻子distribution centers', x + 2 * i, i)
writer.close()

# tensorboard --logdir=runs

运行效果:
Pytorch中使用tensorboard学习笔记(5) 添加条形图add_histogram_第1张图片

你可能感兴趣的:(Pytorch中使用tensorboard学习笔记(5) 添加条形图add_histogram)