'Wraps a decoder into a Beam Search decoder.
Args:
decoder: The original decoder
Returns:
A BeamSearchDecoder with the same interfaces as the original decoder.'

def _get_beam_search_decoder(self, decoder):

    config = beam_search.BeamSearchConfig(beam_width=self.params[u'inference.beam_search.beam_width'], vocab_size=self.target_vocab_info.total_size, eos_token=self.target_vocab_info.special_vocab.SEQUENCE_END, length_penalty_weight=self.params[u'inference.beam_search.length_penalty_weight'], choose_successors_fn=getattr(beam_search, self.params[u'inference.beam_search.choose_successors_fn']))
    return BeamSearchDecoder(decoder=decoder, config=config)
