scharmchi / char-level-cnn-tf

Implementation of Character-level Convolutional Networks for Text Classification in TensorFlow
81 stars 29 forks source link

Output size after last convolutional layer miscalculated? #3

Open JulianFuchs opened 7 years ago

JulianFuchs commented 7 years ago

I think there's a bug on line 89 in model.py

num_features_total = 34 * num_filters_per_size

According to the original paper 'Character-level Convolutional Networks for Text Classification' the size after the last convolutional layer but before the fully connected layers is (original length-96)/27 which is then multiplied with the frame size at the last layer.

But (original length-96)/27 is only 34 if the original length is 1014, as in the original paper. So if you change the sequence_max_length parameter, the model won't work anymore.

Otherwise, thanks a lot for posting your code. Really helped me understand character based CNNs. Really clearly written, easy to understand :)

hbunyamin commented 6 years ago

Hello @JulianFuchs , May I ask whether the bug on line 89 has been fixed? I am studying this repo for understanding CNN for text classification.

Thank You!

hbunyamin commented 6 years ago

Hello again @JulianFuchs, Sorry ... now I understand what you were saying :)

Thanks for the comment!

Best, Hendra