Created
December 30, 2015 18:40
-
-
Save jfsantos/0c3b19fb23ba680dbf3e to your computer and use it in GitHub Desktop.
Example of classifier using Torch and the rnn module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
model = nn.Sequential() | |
lstm = nn.Sequencer( | |
nn.Sequential() | |
:add(nn.LSTM(nFeatures,nHidden)) | |
:add(nn.Dropout()) | |
:add(nn.LSTM(nHidden,nHidden)) | |
) | |
lstm:remember('neither') -- force model to call forget at each call to forward | |
model:add(lstm) | |
model:add(nn.SelectTable(-1)) | |
model:add(nn.Dropout()) | |
model:add(nn.Linear(nHidden, nClasses)) | |
model:add(nn.LogSoftMax()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment