Hi all,
the output of RNN is: h_n (num_layers * num_directions, batch, hidden_size)
and output (seq_len, batch, hidden_size * num_directions)
.
If I would like to use the toppest layer of the h_n
, i.e., (num_directions, batch, hidden_size)
, how should I slice the h_n
?
It seems that:
v1 = h_n.view(num_layers,num_directions,batch,hidden_size)
and
v2 = h_n.view(num_directions,num_layers,batch,hidden_size).permute(1,0,2,3)
are not same. Which one should I use to slice the toppest layer?
Thanks!