EdGENetworks / attention-networks-for-classification

Hierarchical Attention Networks for Document Classification in PyTorch
606 stars 133 forks source link

Can not run the script #6

Closed phonism closed 7 years ago

phonism commented 7 years ago

I got the RuntimeError: input must have 3 dimensions, got 2 in y_pred, state_sent, _ = sent_attn_model(s, state_sent), It seems the dimensions of the s is 2, but the sent_attn_model need 3.

Sandeep42 commented 7 years ago

If a particular document has only one sentence, this code would give you an error. You can try to fix it by not looping when length of sentence is only one. That should ideally fix it :)