TensorFlow中强大的可视化工具
TensorBoard :https://tensorflow.google.cn/tensorboard
TensorBoard provides the visualization and tooling needed for machine learning experimentation:
- Tracking and visualizing metrics such as loss and accuracy
- Visualizing the model graph (ops and layers)
- Viewing histograms of weights, biases, or other tensors as they change over time
- Projecting embeddings to a lower dimensional space
- Displaying images, text, and audio data
- Profiling TensorFlow programs
- And much more
pytorch官方文档:
https://pytorch.org/docs/stable/tensorboard.html?highlight=tensorboard
测试代码:
import numpy as np
from torch.utils.tensorboard import SummaryWriter, writer
writer=SummaryWriter(comment='test tensorboard')
for x in range(100):
writer.add_scalar('y=2x',x*2,x)
writer.add_scalar('y=pow(2,x)',2**x,x)
writer.add_scalars('data/scalar_group',{
"xsinx":x*np.sin(x),
"xcosx":x*np.cos(x),
"arctanx":np.arctan(x),
},x)
writer.close()
运行代码后会生成runs文件夹;
运行命令:
tensorboard --logdir=./runs
参数:--logdir runs文件夹所在的路径
结果: