class_docstr: Batch 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 (BatchHypothesis): The running hypotheses in beam search.
      ended_hyps (List[Hypothesis]): The ended hypotheses in beam search.
  
  Returns:
      BatchHypothesis: 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","(","BatchHypothesis",")",":","The","running","hypotheses","in","beam","search",".","ended_hyps","(","List","[","Hypothesis","]",")",":","The","ended","hypotheses","in","beam","search",".","Returns",":","BatchHypothesis",":","The","new","running","hypotheses","."]
code: def post_process(
      self,
      i: int,
      maxlen: int,
      minlen: int,
      maxlenratio: float,
      running_hyps: BatchHypothesis,
      ended_hyps: List[Hypothesis],
  ) -> BatchHypothesis:
      """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 (BatchHypothesis): The running hypotheses in beam search.
          ended_hyps (List[Hypothesis]): The ended hypotheses in beam search.
  
      Returns:
          BatchHypothesis: The new running hypotheses.
  
      """
      n_batch = running_hyps.yseq.shape[0]
      logger.debug(f"the number of running hypothes: {n_batch}")
      if self.token_list is not None:
          logger.debug(
              "best hypo: "
              + "".join(
                  [
                      self.token_list[x]
                      for x in running_hyps.yseq[
                          0, 1 : running_hyps.length[0]
                      ]
                  ]
              )
          )
      # 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")
          yseq_eos = torch.cat(
              (
                  running_hyps.yseq,
                  torch.full(
                      (n_batch, 1),
                      self.eos,
                      device=running_hyps.yseq.device,
                      dtype=torch.int64,
                  ),
              ),
              1,
          )
          running_hyps.yseq.resize_as_(yseq_eos)
          running_hyps.yseq[:] = yseq_eos
          running_hyps.length[:] = yseq_eos.shape[1]
  
      # add ended hypotheses to a final list, and removed them from current hypotheses
      # (this will be a probmlem, number of hyps < beam)
      is_eos = (
          running_hyps.yseq[
              torch.arange(n_batch), running_hyps.length - 1
          ]
          == self.eos
      )
      for b in torch.nonzero(is_eos, as_tuple=False).view(-1):
          hyp = self._select(running_hyps, b)
          if i >= minlen:
              ended_hyps.append(hyp)
      remained_ids = (
          torch.nonzero(is_eos == 0, as_tuple=False).view(-1).cpu()
      )
      return self._batch_select(running_hyps, remained_ids)
  
imports: import logging
  from typing import Any, Dict, List, NamedTuple, Tuple
  import torch
  from packaging.version import parse
  from torch.nn.utils.rnn import pad_sequence
  from espnet.nets.beam_search import BeamSearch, Hypothesis
label_desc: Use image node_id 11 for calling the BatchBeamSearch obj's underlying member method code with example usage: obj.post_process(i, maxlen, minlen, maxlenratio, running_hyps, ended_hyps) and returns: self