class_docstr: CUDA CTC beam search decoder.
  
  .. devices:: CUDA
  
  Note:
      To build the decoder, please use the factory function :func:`cuda_ctc_decoder`.
docstr: Args:
      log_prob (torch.FloatTensor): GPU tensor of shape `(batch, frame, num_tokens)` storing sequences of
          probability distribution over labels; log_softmax(output of acoustic model).
      lengths (dtype torch.int32): GPU tensor of shape `(batch, )` storing the valid length of
          in time axis of the output Tensor in each batch.
  
  Returns:
      List[List[CUCTCHypothesis]]:
          List of sorted best hypotheses for each audio sequence in the batch.
docstr_tok: ["Args",":","log_prob","(","torch.FloatTensor",")",":","GPU","tensor","of","shape","`","(","batch",",","frame",",","num_tokens",")","`","storing","sequences","of","probability","distribution","over","labels",";","log_softmax","(","output","of","acoustic","model",")",".","lengths","(","dtype","torch.int32",")",":","GPU","tensor","of","shape","`","(","batch",",",")","`","storing","the","valid","length","of","in","time","axis","of","the","output","Tensor","in","each","batch",".","Returns",":","List","[","List","[","CUCTCHypothesis","]","]",":","List","of","sorted","best","hypotheses","for","each","audio","sequence","in","the","batch","."]
code: def __call__(
      self, log_prob: torch.Tensor, encoder_out_lens: torch.Tensor
  ):
      """
      Args:
          log_prob (torch.FloatTensor): GPU tensor of shape `(batch, frame, num_tokens)` storing sequences of
              probability distribution over labels; log_softmax(output of acoustic model).
          lengths (dtype torch.int32): GPU tensor of shape `(batch, )` storing the valid length of
              in time axis of the output Tensor in each batch.
  
      Returns:
          List[List[CUCTCHypothesis]]:
              List of sorted best hypotheses for each audio sequence in the batch.
      """
      if not encoder_out_lens.dtype == torch.int32:
          raise AssertionError("encoder_out_lens must be torch.int32")
      if not log_prob.dtype == torch.float32:
          raise AssertionError("log_prob must be torch.float32")
      if not (log_prob.is_cuda and encoder_out_lens.is_cuda):
          raise AssertionError("inputs must be cuda tensors")
      if not (
          log_prob.is_contiguous() and encoder_out_lens.is_contiguous()
      ):
          raise AssertionError("input tensors must be contiguous")
      (
          required_size,
          score_hyps,
      ) = cuctc.ctc_beam_search_decoder_batch_gpu_v2(
          self.internal_data,
          self.memory.data_ptr(),
          self.memory.size(0),
          log_prob.data_ptr(),
          encoder_out_lens.data_ptr(),
          log_prob.size(),
          log_prob.stride(),
          self.beam_size,
          self.blank_id,
          self.space_id,
          self.blank_skip_threshold,
      )
      if required_size > 0:
          self.memory = torch.empty(
              required_size, dtype=torch.int8, device=log_prob.device
          ).contiguous()
          _, score_hyps = cuctc.ctc_beam_search_decoder_batch_gpu_v2(
              self.internal_data,
              self.memory.data_ptr(),
              self.memory.size(0),
              log_prob.data_ptr(),
              encoder_out_lens.data_ptr(),
              log_prob.size(),
              log_prob.stride(),
              self.beam_size,
              self.blank_id,
              self.space_id,
              self.blank_skip_threshold,
          )
      batch_size = len(score_hyps)
      hypos = []
      for i in range(batch_size):
          hypos.append(
              [
                  CUCTCHypothesis(
                      tokens=score_hyps[i][j][1],
                      words=[
                          self.vocab_list[word_id]
                          for word_id in score_hyps[i][j][1]
                      ],
                      score=score_hyps[i][j][0],
                  )
                  for j in range(self.nbest)
              ]
          )
      return hypos
  
file_path: audio/src/torchaudio/models/decoder/_cuda_ctc_decoder.py
imports: from __future__ import annotations
  import math
  from typing import List, NamedTuple, Union
  import torch
  import torchaudio
  import torchaudio.lib.pybind11_prefixctc
label_desc: Use image node_id 3 for calling the CUCTCDecoder obj's underlying member method code with example usage: obj.__call__(log_prob, encoder_out_lens) and returns: hypos