作者:手机用户2602936393 | 来源:互联网 | 2023-09-16 13:12
这篇文章主要讲解了“Pytorch中使用tensorboard添加matplotlib的方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢
这篇文章主要讲解了“Pytorch中使用tensorboard添加matplotlib的方法”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Pytorch中使用tensorboard添加matplotlib的方法”吧!
代码:
from torch.utils.tensorboard import SummaryWriter# 绘制散点图import numpy as npimport matplotlib.pyplot as plt
np.random.seed(20200910)fig, ax = plt.subplots() ax.plot(10*np.random.randn(100),10*np.random.randn(100),'o')ax.set_title('Simple Scatter')# plt.show()writer = SummaryWriter()writer.add_figure('林麻子matplotlib figure林祖泉',
fig,
global_step=None,
close=False,
walltime=None)# tensorboard --logdir=runs
运行结果展示:
![Pytorch中使用tensorboard添加matplotlib的方法](https://img1.php1.cn/3cd4a/24e5b/807/6610c7cf5b633343.png)
感谢各位的阅读,以上就是“Pytorch中使用tensorboard添加matplotlib的方法”的内容了,经过本文的学习后,相信大家对Pytorch中使用tensorboard添加matplotlib的方法这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是编程笔记,小编将为大家推送更多相关知识点的文章,欢迎关注!