class_docstr: This class implements beam search over transition sequences given an initial ``DecoderState``
  and a ``DecoderStep``, returning the highest scoring final states found by the beam (the states
  will keep track of the transition sequence themselves).
  
  The initial ``DecoderState`` is assumed to be `batched`.  The value we return from the search
  is a dictionary from batch indices to ranked finished states.
  
  IMPORTANT: We assume that the ``DecoderStep`` that you are using returns possible next states
  in sorted order, so we do not do an additional sort inside of ``BeamSearch.search()``.  If
  you're implementing your own ``DecoderStep``, you must ensure that you've sorted the states
  that you return.
code: def __init__(self, beam_size):
      self._beam_size = beam_size
  
file_path: magnitude/pymagnitude/third_party/allennlp/nn/decoding/beam_search.py
imports: from __future__ import absolute_import
  from collections import defaultdict
  from allennlp.common.registrable import FromParams
  from allennlp.nn.decoding.decoder_step import DecoderStep
  from allennlp.nn.decoding.decoder_state import DecoderState
label_desc: Use image node_id 1 to create a new BeamSearch object from inherited base classes: FromParams with example: obj = BeamSearch(beam_size)