parameters: (model: NMT, test_data_src: List[List[str]], beam_size: int, max_decoding_time_step: int)
return_statement: return hypotheses
docstring: Run beam search to construct hypotheses for a list of src-language sentences.
      @param model (NMT): NMT Model
      @param test_data_src (List[List[str]]): List of sentences (words) in source language, from test set.
      @param beam_size (int): beam_size (# of hypotheses to hold for a translation at every step)
      @param max_decoding_time_step (int): maximum sentence length that Beam search can produce
      @returns hypotheses (List[List[Hypothesis]]): List of Hypothesis translations for every source sentence.
docstring_summary: Run beam search to construct hypotheses for a list of src-language sentences.
docstring_tokens: Run beam search to construct hypotheses for a list of src - language sentences .
function: def beam_search(model: NMT, test_data_src: List[List[str]], beam_size: int, max_decoding_time_step: int) -> List[List[Hypothesis]]:
      """ Run beam search to construct hypotheses for a list of src-language sentences.
      @param model (NMT): NMT Model
      @param test_data_src (List[List[str]]): List of sentences (words) in source language, from test set.
      @param beam_size (int): beam_size (# of hypotheses to hold for a translation at every step)
      @param max_decoding_time_step (int): maximum sentence length that Beam search can produce
      @returns hypotheses (List[List[Hypothesis]]): List of Hypothesis translations for every source sentence.
      """
      was_training = model.training
      model.eval()
  
      hypotheses = []
      with torch.no_grad():
          for src_sent in tqdm(test_data_src, desc='Decoding', file=sys.stdout):
              example_hyps = model.beam_search(src_sent, beam_size=beam_size, max_decoding_time_step=max_decoding_time_step)
  
              hypotheses.append(example_hyps)
  
      if was_training: model.train(was_training)
  
      return hypotheses
function_tokens: def beam_search ( model : NMT , test_data_src : List [ List [ str ] ] , beam_size : int , max_decoding_time_step : int ) -> List [ List [ Hypothesis ] ] : was_training = model . training model . eval ( ) hypotheses = [ ] with torch . no_grad ( ) : for src_sent in tqdm ( test_data_src , desc = 'Decoding' , file = sys . stdout ) : example_hyps = model . beam_search ( src_sent , beam_size = beam_size , max_decoding_time_step = max_decoding_time_step ) hypotheses . append ( example_hyps ) if was_training : model . train ( was_training ) return hypotheses