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_))

    原文作者:tensorflow
    原文地址: https://www.cnblogs.com/gaofighting/p/10913569.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞