# 在虚拟环境中安装tensorboard
pip install tensorboard
# tensorboard --logdir="事件文件所在的目录"
tensorboard --logdir="D:\dqw\OneDrive - Monash University\Desktop\LCSTS\logs"
# 生成事件文件
from torch.utils.tensorboard import SummaryWriter #导入SummaryWriter类
#创建实例
writer=SummaryWriter("logs") #把对应的事件文件存储到logs文件夹下
#两个方法
# writer.add_image()
# y=x
for i in range(100):
writer.add_scalar("y=x",i,i)
writer.close()
11-13
5万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-22
2956
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-23
9万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)