Created
March 6, 2017 21:54
-
-
Save X4/f5f71edcbaf5a0c969fba48589878b0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Performs a beam search, to be run in the "Decoder" | |
def Beamsearch(self, | |
predict_fun, # RNN() with: new_states as a list, outputs of shape (batch_size, n_symbols) | |
states0, # RNN()'s initial layer states are equal to states0 | |
batch_size, # Size derived from initial layer states0 | |
start_symbol # Tagging the encoded target sequence with <S> as a start symbol for example | |
stop_symbol # ' ' </S> as a stop symbol for example | |
max_length, # Maximum length of a given sequence | |
beam_size=4 # See [simple beam search](https://github.com/SeitaroShinagawa/simple_beamsearch) for an example of probabilities | |
): | |
return (sequence, mask, scores) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment