是否有可能在没有培训操作的情况下可视化张量流图?

eri*_*krf 8 python visualization machine-learning tensorflow 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).
Run Code Online (Sandbox Code Playgroud)

我想检查图表以找出梯度张量流(双关语意图)被打破的位置.

Max*_*xim 30

是的,您可以将任何图形可视化.试试这个简单的脚本:

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()
Run Code Online (Sandbox Code Playgroud)

然后运行......

tensorboard --logdir=output
Run Code Online (Sandbox Code Playgroud)

......你会看到:

tensorboard

因此,您只需创建一个会话,只是为了将图形写入,FileWriter而不是做任何其他事情.