jiegzhan / multi-class-text-classification-cnn

Classify Kaggle Consumer Finance Complaints into 11 classes. Build the model with CNN (Convolutional Neural Network) and Word Embeddings on Tensorflow.
Apache License 2.0
426 stars 198 forks source link

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

Open lexior68 opened 7 years ago

lexior68 commented 7 years ago

Hi, I am newbie i'd tried your code, but I got "TypeError: Expected int32, got list containing Tensors of type '_Message' instead" error message. How to solve it? Thanks

gustavomr commented 7 years ago

This is because TF changed your API due to version 1.x. You need to change:

self.h_pool = tf.concat(3, pooled_outputs)

self.h_pool = tf.concat(pooled_outputs, 3) # flip params

losses = tf.nn.softmax_cross_entropy_with_logits(self.scores, self.input_y)

losses = tf.nn.softmax_cross_entropy_with_logits(labels = self.input_y, logits = self.scores) # only named arguments accepted

I tested with TF 1.1 and worked! I'll try to make a pull request to it.