pcyin / pytorch_nmt

A neural machine translation model in PyTorch
117 stars 25 forks source link

what is the structure of function beam in nmt.py? #4

Closed iriscxy closed 6 years ago

iriscxy commented 6 years ago

''' prev_hyp_ids = top_new_hyp_pos / tgt_vocab_size word_ids = top_new_hyp_pos % tgt_vocab_size ''' to be specific. what is prev_hyp_ids and what does it use for?

pcyin commented 6 years ago

prev_hyp_ids is the list of indices for the hypotheses in the beam from which a new candidate word comes. For example, prev_hyp_ids [0] is the index of the hypothesis in the beam that generates word_ids[0].

iriscxy commented 6 years ago

why prev_hyp_ids is quotient of top_new_hyp_pos / tgt_vocab_size?