美文网首页
Tensorboard使用

Tensorboard使用

作者: 从此不迷茫 | 来源:发表于2021-09-24 09:09 被阅读0次

以下面代码为例

import math

import torch
from tensorboardX import SummaryWriter
if __name__ == "__main__":
    writer = SummaryWriter()
    funcs = {"sin":math.sin,"cos":math.cos,"tan":math.tan}
    for angle in range(-360,360):  # 以°为角度范围单位,将它们转换为弧度,并计算函数值
        angle_rad = angle*math.pi/180
        for name, fun in funcs.items():
            val = fun(angle_rad)
            writer.add_scalar(name, val, angle)
    writer.close()

文件保存位置为:E:\Deep-Reinforcement-Learning-Hands-On-master\Chapter03
运行后生成文件events.out.tfevents.1632124239.DESKTOP-L5EQ6TT保存在runs目录下的Sep20_15-50-39_DESKTOP-L5EQ6TT文件夹中,pycharm查看方法:
(1)右击Sep20_15-50-39_DESKTOP-L5EQ6TT文件夹,选择open in-terminal,如下图所示:

图1
(2)在终端terminal下输入 tensorboard --logdir=目录位置(即:=E:\Deep-Reinforcement-Learning-Hands-On-master\Chapter03\runs\Sep20_15-50-39_DESKTOP-L5EQ6)。如下图:
图2
(3)点击 http://localhost:6006/ ,即可自动打开浏览器,看到tensorboard界面,如下图
图3

相关文章

网友评论

      本文标题:Tensorboard使用

      本文链接:https://www.haomeiwen.com/subject/hfnagltx.html