Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ideal structure of RNN #3

Open
Shafaq19 opened this issue Oct 3, 2019 · 0 comments
Open

Ideal structure of RNN #3

Shafaq19 opened this issue Oct 3, 2019 · 0 comments

Comments

@Shafaq19
Copy link
Owner

Shafaq19 commented Oct 3, 2019

The ideal structure is as follows:

Embedding layer (nn.Embedding) before the LSTM or GRU layer.
The fully-connected layer comes at the end to get our desired number of outputs.
Extra marks for not using a dropout after LSTM and before FC layer, as the drop out is already incorporated in the LSTMs, A lot of students will add it and then end up finding convergence difficult
You can try to add more than one fc:

init

self.fcc=nn.Linear(self.hidden_dim, self.hidden_dim)
self.fcc2=nn.Linear(self.hidden_dim,self.output_size)
....

forward

output,hidden=self.lstm(embedded,hidden)
lstm_output = output.contiguous().view(-1, self.hidden_dim)
output= self.fcc(output)
output=self.dropout(output)
output=self.fcc2(output)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant