class_docstr: CTC beam search decoder from *Flashlight* :cite:`kahn2022flashlight`.
  
  .. devices:: CPU
  
  Note:
      To build the decoder, please use the factory function :func:`ctc_decoder`.
docstr: Performs batched offline decoding.
  
  .. note::
  
     This method performs offline decoding in one go. To perform incremental decoding,
     please refer to :py:meth:`decode_step`.
  
  Args:
      emissions (torch.FloatTensor): CPU tensor of shape `(batch, frame, num_tokens)` storing sequences of
          probability distribution over labels; output of acoustic model.
      lengths (Tensor or None, optional): CPU tensor of shape `(batch, )` storing the valid length of
          in time axis of the output Tensor in each batch.
  
  Returns:
      List[List[CTCHypothesis]]:
          List of sorted best hypotheses for each audio sequence in the batch.
docstr_tok: ["Performs","batched","offline","decoding",".","..","note",":",":","This","method","performs","offline","decoding","in","one","go",".","To","perform","incremental","decoding",",","please","refer","to",":","py",":","meth",":","`","decode_step","`",".","Args",":","emissions","(","torch.FloatTensor",")",":","CPU","tensor","of","shape","`","(","batch",",","frame",",","num_tokens",")","`","storing","sequences","of","probability","distribution","over","labels",";","output","of","acoustic","model",".","lengths","(","Tensor","or","None",",","optional",")",":","CPU","tensor","of","shape","`","(","batch",",",")","`","storing","the","valid","length","of","in","time","axis","of","the","output","Tensor","in","each","batch",".","Returns",":","List","[","List","[","CTCHypothesis","]","]",":","List","of","sorted","best","hypotheses","for","each","audio","sequence","in","the","batch","."]
code: def __call__(
      self,
      emissions: torch.FloatTensor,
      lengths: Optional[torch.Tensor] = None,
  ) -> List[List[CTCHypothesis]]:
      """
      Performs batched offline decoding.
  
      .. note::
  
         This method performs offline decoding in one go. To perform incremental decoding,
         please refer to :py:meth:`decode_step`.
  
      Args:
          emissions (torch.FloatTensor): CPU tensor of shape `(batch, frame, num_tokens)` storing sequences of
              probability distribution over labels; output of acoustic model.
          lengths (Tensor or None, optional): CPU tensor of shape `(batch, )` storing the valid length of
              in time axis of the output Tensor in each batch.
  
      Returns:
          List[List[CTCHypothesis]]:
              List of sorted best hypotheses for each audio sequence in the batch.
      """
  
      if emissions.dtype != torch.float32:
          raise ValueError("emissions must be float32.")
  
      if not emissions.is_cpu:
          raise RuntimeError("emissions must be a CPU tensor.")
  
      if not emissions.is_contiguous():
          raise RuntimeError("emissions must be contiguous.")
  
      if emissions.ndim != 3:
          raise RuntimeError(
              f"emissions must be 3D. Found {emissions.shape}"
          )
  
      if lengths is not None and not lengths.is_cpu:
          raise RuntimeError("lengths must be a CPU tensor.")
  
      B, T, N = emissions.size()
      if lengths is None:
          lengths = torch.full((B,), T)
  
      float_bytes = 4
      hypos = []
  
      for b in range(B):
          emissions_ptr = (
              emissions.data_ptr()
              + float_bytes * b * emissions.stride(0)
          )
          results = self.decoder.decode(emissions_ptr, lengths[b], N)
          hypos.append(self._to_hypo(results[: self.nbest]))
      return hypos
  
imports: from __future__ import annotations
  import itertools
  from abc import abstractmethod
  from collections import namedtuple
  from typing import Dict, List, NamedTuple, Optional, Tuple, Union
  import torch
  from flashlight.lib.text.decoder import CriterionType, LexiconDecoder, LexiconDecoderOptions, LexiconFreeDecoder, LexiconFreeDecoderOptions, LM, LMState, SmearingMode, Trie, ZeroLM
  from flashlight.lib.text.dictionary import create_word_dict, Dictionary, load_words
  from torchaudio.utils import download_asset
label_desc: Use image node_id 9 for calling the CTCDecoder obj's underlying member method code with example usage: obj.__call__(emissions, lengths) and returns: hypos