class_docstr: Generation beam search.
  
  Note that the attributes list is not exhaustive. Rather, it highlights
  tensors to document their shape. (Since the state variables' "batch"
  size decreases as beams finish, we denote this axis with a B rather than
  ``batch_size``).
  
  Args:
      beam_size (int): Number of beams to use (see base ``parallel_paths``).
      batch_size (int): See base.
      pad (int): See base.
      bos (int): See base.
      eos (int): See base.
      unk (int): See base.
      start (int): See base.
      n_best (int): Don't stop until at least this many beams have
          reached EOS.
      global_scorer (onmt.translate.GNMTGlobalScorer): Scorer instance.
      min_length (int): See base.
      max_length (int): See base.
      return_attention (bool): See base.
      block_ngram_repeat (int): See base.
      exclusion_tokens (set[int]): See base.
  
  Attributes:
      _batch_offset (LongTensor): Shape ``(B,)``.
      _beam_offset (LongTensor): Shape ``(batch_size x beam_size,)``.
      alive_seq (LongTensor): See base.
      topk_log_probs (FloatTensor): Shape ``(B, beam_size,)``. These
          are the scores used for the topk operation.
      src_len (LongTensor): Lengths of encodings. Used for
          masking attentions.
      select_indices (LongTensor or NoneType): Shape
          ``(B x beam_size,)``. This is just a flat view of the
          ``_batch_index``.
      topk_scores (FloatTensor): Shape
          ``(B, beam_size)``. These are the
          scores a sequence will receive if it finishes.
      topk_ids (LongTensor): Shape ``(B, beam_size)``. These are the
          word indices of the topk predictions.
      _batch_index (LongTensor): Shape ``(B, beam_size)``.
      _prev_penalty (FloatTensor or NoneType): Shape
          ``(B, beam_size)``. Initialized to ``None``.
      _coverage (FloatTensor or NoneType): Shape
          ``(1, B x beam_size, inp_seq_len)``.
      hypotheses (list[list[Tuple[Tensor]]]): Contains a tuple
          of score (float), sequence (long), and attention (float or None).
class_docstr_tok: ["Generation","beam","search",".","Note","that","the","attributes","list","is","not","exhaustive",".","Rather",",","it","highlights","tensors","to","document","their","shape",".","(","Since","the","state","variables","'","``","batch","''","size","decreases","as","beams","finish",",","we","denote","this","axis","with","a","B","rather","than","``","batch_size","``",")",".","Args",":","beam_size","(","int",")",":","Number","of","beams","to","use","(","see","base","``","parallel_paths","``",")",".","batch_size","(","int",")",":","See","base",".","pad","(","int",")",":","See","base",".","bos","(","int",")",":","See","base",".","eos","(","int",")",":","See","base",".","unk","(","int",")",":","See","base",".","start","(","int",")",":","See","base",".","n_best","(","int",")",":","Do","n't","stop","until","at","least","this","many","beams","have","reached","EOS",".","global_scorer","(","onmt.translate.GNMTGlobalScorer",")",":","Scorer","instance",".","min_length","(","int",")",":","See","base",".","max_length","(","int",")",":","See","base",".","return_attention","(","bool",")",":","See","base",".","block_ngram_repeat","(","int",")",":","See","base",".","exclusion_tokens","(","set","[","int","]",")",":","See","base",".","Attributes",":","_batch_offset","(","LongTensor",")",":","Shape","``","(","B",",",")","``",".","_beam_offset","(","LongTensor",")",":","Shape","``","(","batch_size","x","beam_size",",",")","``",".","alive_seq","(","LongTensor",")",":","See","base",".","topk_log_probs","(","FloatTensor",")",":","Shape","``","(","B",",","beam_size",",",")","``",".","These","are","the","scores","used","for","the","topk","operation",".","src_len","(","LongTensor",")",":","Lengths","of","encodings",".","Used","for","masking","attentions",".","select_indices","(","LongTensor","or","NoneType",")",":","Shape","``","(","B","x","beam_size",",",")","``",".","This","is","just","a","flat","view","of","the","``","_batch_index","``",".","topk_scores","(","FloatTensor",")",":","Shape","``","(","B",",","beam_size",")","``",".","These","are","the","scores","a","sequence","will","receive","if","it","finishes",".","topk_ids","(","LongTensor",")",":","Shape","``","(","B",",","beam_size",")","``",".","These","are","the","word","indices","of","the","topk","predictions",".","_batch_index","(","LongTensor",")",":","Shape","``","(","B",",","beam_size",")","``",".","_prev_penalty","(","FloatTensor","or","NoneType",")",":","Shape","``","(","B",",","beam_size",")","``",".","Initialized","to","``","None","``",".","_coverage","(","FloatTensor","or","NoneType",")",":","Shape","``","(","1",",","B","x","beam_size",",","inp_seq_len",")","``",".","hypotheses","(","list","[","list","[","Tuple","[","Tensor","]","]","]",")",":","Contains","a","tuple","of","score","(","float",")",",","sequence","(","long",")",",","and","attention","(","float","or","None",")","."]
code: def initialize(self, *args, **kwargs):
      raise NotImplementedError
  
imports: import torch
  from onmt.translate import penalties
  from onmt.translate.decode_strategy import DecodeStrategy
  import warnings
label_desc: Use image node_id 2 for calling the BeamSearchBase obj's underlying member method code with example usage: obj.initialize() without return types