zy1996code / nlp_basic_model

some basic deep learning models/method for nlp, text classification.
81 stars 19 forks source link

Why do you use .view(-1,n_hidden,1) #1

Open oldpants opened 4 years ago

oldpants commented 4 years ago

Hi,zy: I am reading your code and Ihave a question about this code: "hidden = final_state.view(-1, n_hidden , 1)" Why do you use '.view'? In my opinion, It should use '.permute'

oldpants commented 4 years ago

What's more, In " torch.bmm(lstm_output, hidden)". The shape of lstm_output is [batchsize,len_seq,n_hidden],the shape of hidden is [batchsize,2*n_hidden,1]. Can they be multiplied by .bmm?

1panpan1 commented 4 years ago

Actually, the shape of lstm_output is [batchsize,len_seq, 2*n_hidden].