class_docstr: Batch beam search implementation.
code: def _batch_select(
      self, hyps: BatchHypothesis, ids: List[int]
  ) -> BatchHypothesis:
      if self.return_hs:
          hs = [hyps.hs[i] for i in ids]
      else:
          hs = []
  
      return BatchHypothesis(
          yseq=hyps.yseq[ids],
          score=hyps.score[ids],
          length=hyps.length[ids],
          scores={k: v[ids] for k, v in hyps.scores.items()},
          states={
              k: [self.scorers[k].select_state(v, i) for i in ids]
              for k, v in hyps.states.items()
          },
          hs=hs,
      )
  
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 2 for calling the BatchBeamSearch obj's underlying member method code with example usage: obj._batch_select(hyps, ids) and returns: BatchHypothesis