tensorboardエラーおよびソリューション

4726 ワード

バージョンアップ後に変更
Replace 
tf.scalar_summary, tf.histogram_summary, 
tf.audio_summary, tf.image_summary with 
tf.summary.scalar, tf.summary.histogram, 
respectively. The new summary ops take name
meaning summary ops now respect TensorFlow 
name scopes.

スカラーの場合
スカラーを訓練中に可視化するにはtfを用いることができる.summary.損失lossなどのscalar()
loss = tf.reduce_mean(tf.reduce_sum(
tf.square(ys-prediction),reduction_indices=[1])) 
tf.summary.scalar('loss',loss) 

パラメータの場合
tfを使用する.summary.histogram()(フルリンクの重みなど):
tf.summary.histogram("/weights",Weights) 

mergeと実行
変数を初期化する必要があるように、summaryもmergeを必要とします.
merged = tf.summary.merge_all()

次に、出力レコードの実行中のデータを定義します.
writer = tf.summary.FileWriter("output/",
sess.graph)

最後に、トレーニング中にこの2つのモジュールを実行することを覚えておいてください.
for i in range(1000):
    sess.run(train_step,feed_dict={xs:x_data,ys:y_data})
    if i%50==0:# 50     
        result = sess.run(merged,
        feed_dict={xs:x_data,ys:y_data})
        writer.add_summary(result,i) 

つまり、summaryは独立して、以前はtf.XXX_summaryのような下線がtfになった.summary.XXXのフォーマット
1.AttributeError:’module’ object has noattribute ‘random_crop’##ソリューション:distorted_image= tf.image.random_crop(reshaped_image,[height,width])を:distorted_に変更image = tf.random_crop(reshaped_image,[height,width,3])
  • AttributeError:'module'object has no attribute'SummaryWriter##ソリューション:tf.train.SummaryWriterから:tf.summary.FileWriter
  • AttributeError:'module'object has no attribute'summaries'ソリューション:tf.merge_all_summaries()から:summary_に変更op =tf.summaries.merge_all()
  • AttributeError: ‘module’ object hasno attribute’histogram_summary tf.histogram_summary(var.op.name,var)をtf.に変更します.summaries.histogram()
  • AttributeError: ‘module’ object hasno attribute’scalar_summary’ tf.scalar_summary(l.op.name+’’,l)##ソリューション:tf.scalar_summary(‘images’,images)から:tf.summary.scalar(‘images’, images) tf.image_summary(‘images’,images)から:tf.summary.image(‘images’, images)
  • ValueError:Only call softmax_cross_entropy_with_logits withnamed arguments(labels=...,logits=...)##ソリューション:cifar 10.loss(labels,logits)をcifar 10に変更した.loss(logits=logits,labels=labels) cross_entropy=tf.nn.softmax_cross_entropy_with_logits(logits,dense_labels,name=’cross_entropy_per_example’)をcross_entropy =tf.nn.softmax_cross_entropy_with_logits( logits=logits, labels=dense_labels,name=’cross_entropy_per_example’)
  • TypeError: Using a tf.Tensor as a Python bool isnot allowed. Use if t is not None: instead of if t: to test if a tensorisdefined, and use TensorFlow ops such as tf.cond to execute subgraphsconditionedon the value of a tensor. ##解決策:if grad:if grad is not None:
  • に変更
  • ValueError:Shapes(2,128,1)and()are incompatible###ソリューション:concated=tf.concat(1,[indices,sparse_labels])をconcated=tfに変更します.concat([indices, sparse_labels], 1)
  • エラー:(これはしばらく遭遇していません)File"/home/lily/work/tensorflow/CIRFR-10/tensorflow.cifar10-master/cifar10_input.py”,line83, in read_cifar10 result.key, value=reader.read(filename_queue) File”/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/io_ops.py”,line326, in read queue_ref = queue.queue_ref AttributeError: ‘str’ object hasno attribute ‘queue_ref’####ソリューション:トレーニングサンプルのパスを変更する必要があるためcifar 10_input.py中data_dirは、ローカルデータが存在するフォルダに値を割り当てます.http://blog.csdn.net/xiao_lxl/article/details/70622209