nlp_basic_model icon indicating copy to clipboard operation
nlp_basic_model copied to clipboard

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

Open oldpants opened this issue 5 years ago • 2 comments

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 avatar Dec 22 '19 13:12 oldpants

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?

oldpants avatar Dec 22 '19 13:12 oldpants

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

1panpan1 avatar Apr 19 '20 14:04 1panpan1