sgrvinod / a-PyTorch-Tutorial-to-Image-Captioning

Show, Attend, and Tell | a PyTorch Tutorial to Image Captioning
MIT License
2.75k stars 711 forks source link

scores in Beam search should be multiplied or added? #72

Open Zachary-ZS opened 5 years ago

Zachary-ZS commented 5 years ago

Hi @sgrvinod , in the caption.py, line 97, scores = top_k_scores.expand_as(scores) + scores # (s, vocab_size) I wonder why it's added? Shouldn't it be multiplied?

YU1ut commented 5 years ago

Because the score is logarithmic. https://github.com/sgrvinod/a-PyTorch-Tutorial-to-Image-Captioning/blob/master/eval.py#L111