【发布时间】:2017-04-14 14:48:42
【问题描述】:
使用 jupyter 在 Python/tensorflow1.0 中尝试调试语句,但没有从 tf.Print 打印任何输出
Thought sess.run(在下面代码的训练期间)应该评估 db1 张量并打印输出,但没有发生 然而 db1.eval 在评估阶段,打印整个张量 X 而没有“消息 X:”。
def combine_inputs(X):
db1=tf.Print(X,[X],message='X:')
return (tf.matmul(X, W) + b,db1)
<<training code>>
_,summary=sess.run([train_op,merged_summaries])
## merged_summaries tensor triggers combine_inputs function. There are
## other tensor functions/coding in between , not giving entire code to keep
## it simple; code works as expected except tf.Print
<<evaluate code>>
print(db1.eval())
Confused on following
a) Why tf.Print is not printing during sess.run during training?
b) Why explicit db1.eval is necessary , expected tf.Print to trigger with
sess.run. If eval is required , could copy tensor X in my code to db1
and evaluate it with out tf.Print. Correct?
尝试过其他问题(如下面的问题)。建议实现 memory_util 或预定义函数。由于学习者无法理解为什么 tf.Print 在我的场景中不起作用
如果有人遇到类似问题,请帮忙。谢谢!
【问题讨论】:
标签: tensorflow