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

转载于:https://www.cnblogs.com/gaofighting/p/10913569.html

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值