cnn_text_classification icon indicating copy to clipboard operation
cnn_text_classification copied to clipboard

Error in train.py: ValueError: Shapes (3, ?, 1, 1, 128) and () are incompatible

Open anhduc2203 opened this issue 6 years ago • 3 comments

Hi all, I have an issue when run train.py: TensorFlow binary was not compiled to use: AVX2 FMA Traceback (most recent call last): File "train.py", line 90, in l2_reg_lambda=FLAGS.l2_reg_lambda) File "/home/anhduc/environments/my_env/cnn_text_classification/text_cnn.py", line 57, in init self.h_pool = tf.concat(3, pooled_outputs) File "/home/anhduc/environments/my_env/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1122, in concat tensor_shape.scalar()) File "/home/anhduc/environments/my_env/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py", line 848, in assert_is_compatible_with raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (3, ?, 1, 1, 128) and () are incompatible

anhduc2203 avatar Mar 07 '19 08:03 anhduc2203

Hi @anhduc2203 this API are pretty old. I would try with newer tensorflow API. Hope it helps

manishanker avatar Mar 23 '19 15:03 manishanker

I have the same problem, can you help me solve it?

File "C:/Users/LeeHyungGeol/PycharmProjects/cnn-text-classification-tf/train.py", line 72, in l2_reg_lambda=FLAGS.l2_reg_lambda) File "C:\Users\LeeHyungGeol\PycharmProjects\cnn-text-classification-tf\text_cnn.py", line 57, in init self.h_pool = tf.concat(3, pooled_outputs) File "C:\Users\LeeHyungGeol\Anaconda3\lib\site-packages\tensorflow\python\util\dispatch.py", line 180, in wrapper return target(*args, **kwargs) File "C:\Users\LeeHyungGeol\Anaconda3\lib\site-packages\tensorflow\python\ops\array_ops.py", line 1254, in concat tensor_shape.scalar()) File "C:\Users\LeeHyungGeol\Anaconda3\lib\site-packages\tensorflow\python\framework\tensor_shape.py", line 1023, in assert_is_compatible_with raise ValueError("Shapes %s and %s are incompatible" % (self, other)) ValueError: Shapes (3, ?, 1, 1, 128) and () are incompatible

LeeHyungGeol avatar Mar 18 '20 09:03 LeeHyungGeol

Hey this code is quite outdated now.

manishanker avatar Mar 18 '20 15:03 manishanker