【问题标题】:Why tensorboard does not show the graph?为什么张量板不显示图表?
【发布时间】:2017-04-28 14:37:26
【问题描述】:

这是一个使用 tensorflow 在计算图中创建单个节点的简单代码:

import tensorflow as tf
tf.constant(5)
writer = tf.summary.FileWriter('./path', tf.Session().graph)
writer.close()

当我尝试使用 tensorboard 可视化此图表时,没有显示图表。这是我的终端代码:

tensorboard --logdir=[![enter image description here][1]][1]path --port 6006

我的代码有什么问题?

【问题讨论】:

    标签: python tensorflow tensorboard


    【解决方案1】:

    您的代码中没有计算图。只有一个顶点什么都不做。创建一个至少包含一个操作的图表:

    import tensorflow as tf
    a = tf.constant(5)
    b = tf.constant(5)
    c = a + b
    
    with tf.Session() as sess:
        writer = tf.summary.FileWriter('path', sess.graph)
        writer.close()
    

    你会看到的

    【讨论】:

    • 斯坦福CS20SI课程第二讲,讲师说tf.constant是一个操作。那么,似乎只有一个常数的图可以被视为计算图?我说的对吗?
    • @Hossein 它可以被处理(一个顶点的图是一个图),但你不知道 TB 是如何实现的。尝试放置一个变量而不是一个常量。
    猜你喜欢
    • 2017-08-12
    • 2020-12-30
    • 1970-01-01
    • 2018-01-28
    • 2022-06-16
    • 2019-05-31
    • 1970-01-01
    • 2020-11-17
    • 1970-01-01
    相关资源
    最近更新 更多