繁体   English   中英

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

[英]Is it possible to visualize a tensorflow graph without a training op?

我知道如何在使用张量板训练后可视化张量流图。 现在,是否可以只显示图形的前向部分,即没有定义训练操作符?

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

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).

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

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

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

......你会看到:

tensorboard

所以你可以简单地创建一个会话,只是为了将图形写入FileWriter而不做任何其他事情。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM