【问题标题】:Is it possible to visualize a tensorflow graph without a training op?是否可以在没有训练操作的情况下可视化张量流图?
【发布时间】:2018-07-01 15:28:10
【问题描述】:

我知道如何在使用 tensorboard 训练后可视化张量流图。现在,是否可以只可视化图形的前部,即没有定义训练算子?

我问这个的原因是我收到了这个错误:

No gradients provided for any variable, check your graph for ops that do not support gradients, between variables [ ... list of model variables here ... ] and loss Tensor("Mean:0", dtype=float32).

我想检查图表以找出梯度张量流(双关语)被破坏的地方。

【问题讨论】:

  • 这看起来像 Tensorflow v1。 TF 2.0(不是 Tensorboard)中是否有类似的东西?

标签: python tensorflow machine-learning visualization tensorboard


【解决方案1】:

是的,您可以可视化任何图表。试试这个简单的脚本:

import tensorflow as tf

a = tf.add(1, 2, name="Add_these_numbers")
b = tf.multiply(a, 3)
c = tf.add(4, 5, name="And_These_ones")
d = tf.multiply(c, 6, name="Multiply_these_numbers")
e = tf.multiply(4, 5, name="B_add")
f = tf.div(c, 6, name="B_mul")
g = tf.add(b, d)
h = tf.multiply(g, f)

with tf.Session() as sess:
    writer = tf.summary.FileWriter("output", sess.graph)
    print(sess.run(h))
    writer.close()

然后运行...

tensorboard --logdir=output

...你会看到:

因此,您可以简单地创建一个会话,将图表写入FileWriter,而无需执行任何其他操作。

【讨论】:

  • 我都做了。还是一样的信息。 @马克西姆
猜你喜欢
  • 2018-12-03
  • 1970-01-01
  • 2021-06-28
  • 2016-09-16
  • 1970-01-01
  • 2018-09-18
  • 2021-07-29
  • 2016-07-26
  • 1970-01-01
相关资源
最近更新 更多