美文网首页
TensorFlow学习之TensorBoard(二)

TensorFlow学习之TensorBoard(二)

作者: zhglance | 来源:发表于2019-12-03 15:59 被阅读0次

TensorBoard为TensorFlow提供计算的图形图像,通过读取 TensorFlow 事件文件,实现了数据流的可视化,并且能够显示神经网络执行的量化指标和摘要数据。

代码示例:

import tensorflow as tf

#定义命名空间,两个标量相加
with tf.name_scope('board_demo') as scope:
    input_1 = tf.constant(10, name='input_1')
    input_2 = tf.constant(1000, name='input_2')
    add_op = tf.add(input_1, input_2, name='add_op')
sess = tf.compat.v1.InteractiveSession()

#写入日志
log_writer = tf.compat.v1.summary.FileWriter('D:/Lance/tensorflow/logs', sess.graph)
global_var_init = tf.compat.v1.global_variables_initializer()
sess.run(global_var_init)

执行run,然后再命令行输入:tensorboard --logdir=D:/Lance/tensorflow/logs,回车换行

输出结果如下:

tensorboard 输出.png

在浏览器中打开:http://localhost:6006/ ,显示如下:

tensorboard界面.png

双击命名空间:board_demo,显示数据流图


board_demo命名空间.png

图形表示:


图形表示图.png

相关文章

网友评论

      本文标题:TensorFlow学习之TensorBoard(二)

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