class_docstr: Batch beam search implementation.
docstr: Convert list to batch.
docstr_tok: ["Convert","list","to","batch","."]
code: def batchfy(self, hyps: List[Hypothesis]) -> BatchHypothesis:
      """Convert list to batch."""
      if len(hyps) == 0:
          return BatchHypothesis()
  
      if self.return_hs:
          hs = [h.hs for h in hyps]
      else:
          hs = []
  
      return BatchHypothesis(
          yseq=pad_sequence(
              [h.yseq for h in hyps],
              batch_first=True,
              padding_value=self.eos,
          ),
          length=torch.tensor(
              [len(h.yseq) for h in hyps], dtype=torch.int64
          ),
          score=torch.tensor([h.score for h in hyps]),
          scores={
              k: torch.tensor([h.scores[k] for h in hyps])
              for k in self.scorers
          },
          states={k: [h.states[k] for h in hyps] for k in self.scorers},
          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 1 for calling the BatchBeamSearch obj's underlying member method code with example usage: obj.batchfy(hyps) and returns: BatchHypothesis, BatchHypothesis