Tensorflow所遇坑


 

TensorFlow問題:

1、FLAGS._parse_flags()報錯AttributeError:_parse_flags

解決:

因為TensorFlow的版本問題了,TensorFlow版本升級后,它就無情的拋棄了FLAGS._parse_flags()這種用法,改成了用FLAGS.flag_values_dict()

2、raise ValueError("Shapes %s and %s are incompatible" % (self, other))
      ValueError: Shapes (3, ?, 1, 1, 128) and () are incompatible

解決:

concated = tf.concat(1, [indices, sparse_labels])改為:

concated= tf.concat([indices, sparse_labels], 1)

3、WARNING:softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.

Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See tf.nn.softmax_cross_entropy_with_logits_v2.

解決:

將tf.nn.softmax_cross_entropy_with_logits改為:
tf.nn.softmax_cross_entropy_with_logits_v2

4.ValueError: Only call `softmax_cross_entropy_with_logits` with named arguments (labels=..., logits=..., ...)

解決:

將cross_entropy2=tf.reduce_sum(tf.nn.softmax_cross_entropy_with_logits_v2(logits, y_))改為:

cross_entropy2=tf.reduce_sum(tf.nn.softmax_cross_entropy_with_logits_v2(labels=logits, logits=y_))


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM