-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix self.init_hidden never used #95
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
Conversation
@@ -180,8 +180,8 @@ def __init__(self, vocab_size, tag_to_ix, embedding_dim, hidden_dim): | |||
self.hidden = self.init_hidden() | |||
|
|||
def init_hidden(self): | |||
return (autograd.Variable(torch.randn(2, 1, self.hidden_dim)), | |||
autograd.Variable(torch.randn(2, 1, self.hidden_dim))) | |||
return (autograd.Variable(torch.randn(2, 1, self.hidden_dim / 2)), |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -217,7 +217,7 @@ def _forward_alg(self, feats): | |||
def _get_lstm_features(self, sentence): | |||
self.hidden = self.init_hidden() | |||
embeds = self.word_embeds(sentence).view(len(sentence), 1, -1) | |||
lstm_out, self.hidden = self.lstm(embeds) | |||
lstm_out, self.hidden = self.lstm(embeds, self.hidden) |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Thanks @cmusjtuliuyuan! |
No description provided.