class_docstr: Decodes the output of Beam Search to get the top hypotheses
class_docstr_tok: ["Decodes","the","output","of","Beam","Search","to","get","the","top","hypotheses"]
docstr: Returns a mapping from each output position and the beam index that was
  picked from the beam search results.
docstr_tok: ["Returns","a","mapping","from","each","output","position","and","the","beam","index","that","was","picked","from","the","beam","search","results","."]
code: def _get_output_steps_to_beam_indices(
      self, end_state: Tensor, beam_prev_indices: Tensor
  ) -> List[int]:
      """
      Returns a mapping from each output position and the beam index that was
      picked from the beam search results.
      """
      present_position = int(end_state[1])
      beam_index = int(end_state[2])
      beam_indices = torch.jit.annotate(List[int], [])
      while present_position >= 0:
          beam_indices.insert(0, beam_index)
          beam_index = beam_prev_indices[present_position][beam_index]
          present_position = present_position - 1
      return beam_indices
  
file_path: pytext/pytext/torchscript/seq2seq/beam_decode.py
imports: from typing import List, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 3 for calling the BeamDecode obj's underlying member method code with example usage: obj._get_output_steps_to_beam_indices(end_state, beam_prev_indices) and returns: beam_indices