cnn-text-classification-tf icon indicating copy to clipboard operation
cnn-text-classification-tf copied to clipboard

Expected int32 but got a list containing Tensors of type '_Message' in "train.py"

Open rajeshr6r opened this issue 8 years ago • 5 comments

Hi,

Thanks for the excellent piece of work . But I'm getting the following error while I try to initiate the function call in this line . Not sure whats wrong .

Message : Expected int32 but got a list containing Tensors of type '_Message' in "train.py"

cnn = TextCNN( sequence_length=x_train.shape[1], num_classes=y_train.shape[1], vocab_size=len(vocab_processor.vocabulary_), embedding_size=FLAGS.embedding_dim, filter_sizes=list(map(int, FLAGS.filter_sizes.split(","))),
num_filters=FLAGS.num_filters,
l2_reg_lambda=FLAGS.l2_reg_lambda )

rajeshr6r avatar Feb 21 '17 15:02 rajeshr6r

Using the fix suggested here https://github.com/dennybritz/cnn-text-classification-tf/issues/67 works. They changed some API calls in TF 1.0

benstoffelen avatar Feb 21 '17 21:02 benstoffelen

When I run this program with cpu version of tensorflow, it works well. But it throws an exception when training with the gpu version of tensorflow. The error message is as following. How can I to solve this problem?

TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

Traceback (most recent call last): File "train.py", line 111, in l2_reg_lambda=FLAGS.l2_reg_lambda) File "/home/Python/cnn-text-classification-tf/text_cnn.py", line 57, in _init_ self.h_pool = tf.concat(pooled_outputs, 3)

ShirleyYangGit avatar Mar 26 '17 08:03 ShirleyYangGit

See https://github.com/tensorflow/tensorflow/issues/7031 for solution

shaktisd avatar Mar 26 '17 09:03 shaktisd

the given link https://github.com/tensorflow/tensorflow/issues/7031 is not working

saurjain108 avatar Apr 08 '17 15:04 saurjain108

@benstoffelen It's work for me!

zhchzs avatar May 10 '17 08:05 zhchzs