1. 使用tensorboard no scalar data was found。
解決方案link:https://github.com/tensorflow/tensorflow/issues/2353
在使用tf.summary記錄驗證集的損失時,總是發現no scalar data was found。
with tf.Session(graph=g) as sess:
sess.run(tf.global_variables_initializer())
# create FileWrite object that writes the logs
file_writer = tf.summary.FileWriter(logdir='logs/3', graph=g)
for i in range(5):
# fetch the summary from the graph
result, summary = sess.run([train_op, merged_summary],
feed_dict={some_value: i})
# write the summary to the log
file_writer.add_summary(summary=summary, global_step=i)
file_writer.flush()
記得在file_writer.add_summary語句之後加一個file_writer.flush()。因為電腦可能會覺得你的資料太便宜了,“Turned out my example ops were too "cheap" to compute, and adding a
file_writer.flush()
after adding the summary to the write solved the issue.“