class_docstr: Beam search implementation.
docstr: Perform post-processing of beam search iterations.
  
  Args:
      i (int): The length of hypothesis tokens.
      maxlen (int): The maximum length of tokens in beam search.
      maxlenratio (int): The maximum length ratio in beam search.
      running_hyps (List[Hypothesis]): The running hypotheses in beam search.
      ended_hyps (List[Hypothesis]): The ended hypotheses in beam search.
  
  Returns:
      List[Hypothesis]: The new running hypotheses.
docstr_tok: ["Perform","post-processing","of","beam","search","iterations",".","Args",":","i","(","int",")",":","The","length","of","hypothesis","tokens",".","maxlen","(","int",")",":","The","maximum","length","of","tokens","in","beam","search",".","maxlenratio","(","int",")",":","The","maximum","length","ratio","in","beam","search",".","running_hyps","(","List","[","Hypothesis","]",")",":","The","running","hypotheses","in","beam","search",".","ended_hyps","(","List","[","Hypothesis","]",")",":","The","ended","hypotheses","in","beam","search",".","Returns",":","List","[","Hypothesis","]",":","The","new","running","hypotheses","."]
code: def post_process(
      self,
      i: int,
      maxlen: int,
      minlen: int,
      maxlenratio: float,
      running_hyps: List[Hypothesis],
      ended_hyps: List[Hypothesis],
  ) -> List[Hypothesis]:
      """Perform post-processing of beam search iterations.
  
      Args:
          i (int): The length of hypothesis tokens.
          maxlen (int): The maximum length of tokens in beam search.
          maxlenratio (int): The maximum length ratio in beam search.
          running_hyps (List[Hypothesis]): The running hypotheses in beam search.
          ended_hyps (List[Hypothesis]): The ended hypotheses in beam search.
  
      Returns:
          List[Hypothesis]: The new running hypotheses.
  
      """
      logger.debug(
          f"the number of running hypotheses: {len(running_hyps)}"
      )
      if self.token_list is not None:
          logger.debug(
              "best hypo: "
              + "".join(
                  [self.token_list[x] for x in running_hyps[0].yseq[1:]]
              )
          )
      # add eos in the final loop to avoid that there are no ended hyps
      if i == maxlen - 1:
          logger.info("adding <eos> in the last position in the loop")
          running_hyps = [
              h._replace(yseq=self.append_token(h.yseq, self.eos))
              for h in running_hyps
          ]
  
      # add ended hypotheses to a final list, and removed them from current hypotheses
      # (this will be a problem, number of hyps < beam)
      remained_hyps = []
      for hyp in running_hyps:
          if hyp.yseq[-1] == self.eos:
              # e.g., Word LM needs to add final <eos> score
              for k, d in chain(
                  self.full_scorers.items(), self.part_scorers.items()
              ):
                  s = d.final_score(hyp.states[k])
                  hyp.scores[k] += s
                  hyp = hyp._replace(
                      score=hyp.score + self.weights[k] * s
                  )
              if i >= minlen:
                  ended_hyps.append(hyp)
          else:
              remained_hyps.append(hyp)
      return remained_hyps
  
imports: import logging
  from itertools import chain
  from typing import Any, Dict, List, NamedTuple, Tuple, Union
  import torch
  from espnet.nets.e2e_asr_common import end_detect
  from espnet.nets.scorer_interface import PartialScorerInterface, ScorerInterface
label_desc: Use image node_id 12 for calling the BeamSearch obj's underlying member method code with example usage: obj.post_process(i, maxlen, minlen, maxlenratio, running_hyps, ended_hyps) and returns: remained_hyps