Skip to content

Instantly share code, notes, and snippets.

@Terryhung
Created July 11, 2018 14:56
Show Gist options
  • Save Terryhung/5cbb116de4b09a150da0bfa5e4d4841d to your computer and use it in GitHub Desktop.
Save Terryhung/5cbb116de4b09a150da0bfa5e4d4841d to your computer and use it in GitHub Desktop.
def forward(self, feature):
for f in feature:
f = torch.from_numpy(f)
f = f.float()
lstm_out, self.hidden = self.lstm(
f.view(1, 1, len(f)), self.hidden)
tag_space = self.hidden2tag(lstm_out.view(1, self.hidden_dim))
tag_scores = F.log_softmax(tag_space, dim=1)
return tag_scores
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment