LM-LSTM-CRF icon indicating copy to clipboard operation
LM-LSTM-CRF copied to clipboard

About the score given a sequence and a target

Open helenxu opened this issue 5 years ago • 0 comments

Dear Author,

Thank you for sharing the code. I have a question about the forward() in CRFLoss_vb() in crf.py, it calculates the score of the golden state by:

tg_energy = torch.gather(scores.view(seq_len, bat_size, -1), 2, target).view(seq_len, bat_size)
tg_energy = tg_energy.masked_select(mask).sum()

However, it seems that each tag of the target sequence is handled separately and I don't really see the transitions like tag1->tag2->tag3->... Can you explain a little bit?

helenxu avatar May 17 '19 07:05 helenxu