【问题标题】:How to display a graph on TensorBoard如何在 TensorBoard 上显示图表
【发布时间】:2020-11-24 17:45:03
【问题描述】:

我只想在 TensorBoard 上显示一个简单的图表: [1

我试过了:

%load_ext tensorboard
import tensorflow as tf

a = tf.constant(2, dtype=tf.float32, name='tensor_a')
b = tf.constant(3, dtype=tf.float32, name='tensor_b')
c = tf.add(a,b)
writer = tf.summary.create_file_writer('/content/grafo1')
tf.summary.write('test',c)

import tensorboard
%tensorboard --logdir=grafo1

使用 Colab。

但是:“当前数据集没有处于活动状态的仪表板。”

任何帮助将不胜感激

【问题讨论】:

    标签: python tensorflow google-colaboratory tensorboard


    【解决方案1】:

    如果启用了急切执行,您似乎看不到图表。

    您可以使用以下代码实现您的目标:

    %load_ext tensorboard
    import tensorflow.compat.v1 as tf
    
    tf.disable_eager_execution()
    
    a = tf.constant(2, dtype=tf.float32, name='tensor_a')
    b = tf.constant(3, dtype=tf.float32, name='tensor_b')
    c = tf.add(a,b)
    
    writer = tf.summary.FileWriter('/content/grafo1', graph=tf.get_default_graph())
    writer.flush()
    
    import tensorboard
    %tensorboard --logdir=grafo1
    

    【讨论】:

      猜你喜欢
      • 2019-04-30
      • 1970-01-01
      • 2019-12-31
      • 2019-02-27
      • 2017-11-02
      • 2016-02-14
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      相关资源
      最近更新 更多