tensorflow 问题汇总,持续更新...

  • (1) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.
  • (2) TypeError: Expected int32, got <tf.Variable 'PolicyNetwork/pad_embed:0' shape=(1, 200) dtype=float32_ref> of type 'Variable' instead.
     

解决方法:

查了很多都说要重新装TensorFlow,然后找到了下面的解决方法:

https://stackoverflow.com/questions/41813665/tensorflow-slim-typeerror-expected-int32-got-list-containing-tensors-of-type

You just have to update all the line with tf.concat

for example

net = tf.concat(3, [branch_0, branch_1, branch_2, branch_3])

should be changed to

net = tf.concat([branch_0, branch_1, branch_2, branch_3], 3)
  •  (3) AttributeError: module 'tensorflow' has no attribute 'mul'.

https://stackoverflow.com/questions/42217059/tensorflowattributeerror-module-object-has-no-attribute-mul

According to the tensorflow 1.0.0 release notes,

tf.multf.sub and tf.neg are deprecated in favor of tf.multiplytf.subtract and tf.negative.

You'll need to replace tf.mul with tf.multiply.

  •  (4) TypeError: Input 'split_dim' of 'Split' Op has type float32 that does not match expected type of int32.

https://github.com/tensorflow/models/issues/933

The documentation clearly indicates the calling order for tf.split should be:

tf.split(split_dim, num_split, value, name='split')

But the actual code indicates:

def split(value, num_or_size_splits, axis=0, num=None, name="split"):
  • (5)AttributeError: module 'tensorflow.tools.api.generator.api.nn' has no attribute 'rnn'

在新版本中,tf.nn.rnn 被 tf.nn.static_rnn 替换。

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

tf.nn.softmax_cross_entropy_with_logits(logits_expanded,labels)

更换为:

tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=logits_expanded,labels=labels))

  • (7)python版本问题:

Is generator.next() visible in python 3.0?

But instead of calling g.__next__(), as Paolo says, use next(g).

  • (8)

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值