2017-12-07 3 views
0

나는 훈련을 위해 복잡한 손실 함수를 가지고 있지만 평가를 위해 더 간단한 것 (조상을 공유 함) 인 tensorflow 그래프를 가지고 있습니다. 본질적으로 이것은 무엇이 진행되고 있는지 더 잘 이해하기 위해 요약을 추가하기 위해특정 지점에 대한 요약

train_op = ... (needs more things in feed_dict etc.) 
acc = .... (just needs one value for placeholer) 

으로 요약했습니다. 그러나

merged = tf.summary.merge_all() 

과를 호출하면 다음

(summ, acc) = session.run([merged, acc_eval], feed_dict={..}) 

tensorflow은 자리 값이없는 것을 불평한다.

답변

1

귀하의 질문을 이해하기 만하면 특정 텐서 흐름 작업을 요약하기 위해 특별히 실행해야합니다. 예를 들어

: 또한

# define accuracy ops 
correct_prediction = tf.equal(tf.argmax(Y, axis=1), tf.argmax(Y_labels, axis=1)) 
accuracy = tf.reduce_mean(tf.cast(correct_prediction, dtype=tf.float32)) 

# summary_accuracy is the Summary protocol buffer you need to run, 
# instead of merge_all(), if you want to summary specific ops 
summary_accuracy = tf.summary.scalar('testing_accuracy', accuracy) 

# define writer file 
sess.run(tf.global_variables_initializer()) 
test_writer = tf.summary.FileWriter('log/test', sess.graph) 

(summ, acc) = sess.run([summary_accuracy, accuracy], feed_dict={..}) 
test_writer.add_summary(summ) 

, 당신은 tf.summary.merge(), which is documented here를 사용할 수 있습니다.
희망이 도움이됩니다!

관련 문제