Skip to content

Fix and enhance beam_search_op and beam_searc_decode_op#11238

Merged
guoshengCS merged 13 commits intoPaddlePaddle:developfrom
guoshengCS:fix-beam_search
Jun 27, 2018
Merged

Fix and enhance beam_search_op and beam_searc_decode_op#11238
guoshengCS merged 13 commits intoPaddlePaddle:developfrom
guoshengCS:fix-beam_search

Conversation

@guoshengCS
Copy link
Contributor

@guoshengCS guoshengCS commented Jun 6, 2018

Fix and enhance beam_search_op and beam_searc_decode_op

Refer the source sentence as beam and the hypothesis as branch, then some points of the fix and enhancement are as following:

  • beam_search_op:
    • The ended branch should not be pruned since it still might be sifted out because of low score.
    • Force the prediction of ended branch to allocate all probability mass to end token.
    • Though the ended branch cann't be pruned , the ended beam whose branches are all finished can be pruned.
  • beam_search_decode_op:
    • Constructs the full hypotheses for each source sentence by walking back along the LoDTensorArray Input(ids).
    • Sort the hypotheses of each source sentence by their scores.
kuke
kuke previously approved these changes Jun 26, 2018
Copy link
Contributor

@kuke kuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@kuke kuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@guoshengCS guoshengCS merged commit 8df303c into PaddlePaddle:develop Jun 27, 2018
guoshengCS added a commit to guoshengCS/Paddle that referenced this pull request Jun 28, 2018
Fix and enhance beam_search_op and beam_searc_decode_op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants