Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

直接运行时候, 报错 #19

Open
ghost opened this issue Jul 26, 2017 · 3 comments
Open

直接运行时候, 报错 #19

ghost opened this issue Jul 26, 2017 · 3 comments

Comments

@ghost
Copy link

ghost commented Jul 26, 2017

你好啊, 我这边直接 ./train.py 就报错了
会不会是版本不对? 0.9.0 >> 1.0.1

我的 tensorflow 版本为 1.0.1
python 为 2.7.13

Traceback (most recent call last): File "./train.py", line 76, in <module> l2_reg_lambda=FLAGS.l2_reg_lambda) File "/Users/edwardchan/projects/classification/cnn-text-classification-tf-chinese/text_cnn.py", line 75, in __init__ self.h_pool = tf.concat(3, pooled_outputs) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1029, in concat dtype=dtypes.int32).get_shape( File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 637, in convert_to_tensor as_ref=False) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 702, in internal_convert_to_tensor ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 110, in _constant_tensor_conversion_function return constant(v, dtype=dtype, name=name) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 99, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto _AssertCompatible(values, dtype) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).__name__)) TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

@indiejoseph
Copy link
Owner

應該是版本問題

@Meatlf
Copy link

Meatlf commented Oct 15, 2017

@chopperWIN 请问你这个问题解决好了吗?可以告诉我一下是如何解决的呢?

@lijingpeng
Copy link

@Meatlf 是版本的问题,我的版本是1.4,遇到了同样的问题
Expected int32, got list containing Tensors of type '_Message' instead
修改text_cnn.py第75行:
把tf.concat(3, pooled_outputs)
改为:
tf.concat(pooled_outputs, 3)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants