MCPcopy Create free account
hub / github.com/pytorch/tutorials / neg_log_likelihood

Method neg_log_likelihood

beginner_source/nlp/advanced_tutorial.py:278–282  ·  view source on GitHub ↗
(self, sentence, tags)

Source from the content-addressed store, hash-verified

276 return path_score, best_path
277
278 def neg_log_likelihood(self, sentence, tags):
279 feats = self._get_lstm_features(sentence)
280 forward_score = self._forward_alg(feats)
281 gold_score = self._score_sentence(feats, tags)
282 return forward_score - gold_score
283
284 def forward(self, sentence): # dont confuse this with _forward_alg above.
285 # Get the emission scores from the BiLSTM

Callers 1

Calls 3

_get_lstm_featuresMethod · 0.95
_forward_algMethod · 0.95
_score_sentenceMethod · 0.95

Tested by

no test coverage detected