2016-04-12 6 views
2

私はテンソルフローが非常に新しいので、最初のテンソルボードを表示しようとしています。Tensorboad - add_summaryによってコードがクラッシュする

私はダウンロードして[OK]を実行例えばボードは、法に従い、ここで https://www.tensorflow.org/versions/r0.7/how_tos/summaries_and_tensorboard/index.html

与え、私は私のコードを持っている:

weights_hidden = tf.Variable(tf.truncated_normal([image_size * image_size, 1024]), name='weights_hidden') 
_ = tf.histogram_summary('weights_hidden', weights_hidden) 

と私は

with tf.Session(graph=graph) as session: 
    merged = tf.merge_all_summaries() 
    writer = tf.train.SummaryWriter("/tmp/test", session.graph_def) 
    tf.initialize_all_variables().run() 
    for step in range(num_steps): 
    summary_str, l, predictions = session.run(
     [optimizer, loss, train_prediction], feed_dict=feed_dict) 

    if (step % 500 == 0): 
     writer.add_summary(summary_str, step) 
セッションを実行します

プロセスが次のエラーでクラッシュする

Traceback (most recent call last): 
    File "/home/xxx/Desktop/xxx/xxx.py", line 108, in <module> 
    writer.add_summary(summary_str, step) 
    File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/summary_io.py", line 128, in add_summary 
    event = event_pb2.Event(wall_time=time.time(), summary=summary) 
    File "/usr/local/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", line 522, in init 
    _ReraiseTypeErrorWithFieldName(message_descriptor.name, field_name) 
    File "/usr/local/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", line 453, in _ReraiseTypeErrorWithFieldName 
    six.reraise(type(exc), exc, sys.exc_info()[2]) 
    File "/usr/local/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", line 520, in init 
    copy.MergeFrom(new_val) 
    File "/usr/local/lib/python2.7/dist-packages/google/protobuf/internal/python_message.py", line 1237, in MergeFrom 
    "expected %s got %s." % (cls.__name__, type(msg).__name__)) 
TypeError: Parameter to MergeFrom() must be instance of same class: expected Summary got NoneType. for field Event.summary 

私は何が欠けていますか? /コメント

が助け

K.あなたが書くべき

答えて

3

のためにありがとうございました非常に歓迎されるであろうすべてのヘルプ:

_, summary_str, l, predictions = session.run(
    [optimizer, merged, loss, train_prediction], feed_dict=feed_dict) 

私はに対応して4番目の引数mergedを追加しましたあなたが得ようとしている要約(最適化ステップの結果しか得ていない)。

+0

Yessss !!それは今再び正しく実行されます:)(はるかに低速ですが、意味があります)ありがとうOlivier – Kalanit

+0

http://0.0.0.0:6006/#histogramsに表示されない理由を知っていれば興味があります;)テンソルボードを再起動してコードを再実行した後でも、「ヒストグラムタグが見つかりませんでした」と表示されます – Kalanit

+0

tensorboardコマンドは正常ですか? 'テンソルボード--logdir/tmp/test'でなければなりません あなたのロスを' l'で表示するかどうかを確認することもできます。 –

関連する問題