class_docstr: Class to store batched hypotheses (labels, time_indices, scores) for efficient RNNT decoding
class_docstr_tok: ["Class","to","store","batched","hypotheses","(","labels",",","time_indices",",","scores",")","for","efficient","RNNT","decoding"]
docstr: Args:
      batch_size: batch size for hypotheses
      init_length: initial estimate for the length of hypotheses (if the real length is higher, tensors will be reallocated)
      device: device for storing hypotheses
      float_dtype: float type for scores
docstr_tok: ["Args",":","batch_size",":","batch","size","for","hypotheses","init_length",":","initial","estimate","for","the","length","of","hypotheses","(","if","the","real","length","is","higher",",","tensors","will","be","reallocated",")","device",":","device","for","storing","hypotheses","float_dtype",":","float","type","for","scores"]
code: def __init__(
      self,
      batch_size: int,
      init_length: int,
      device: Optional[torch.device] = None,
      float_dtype: Optional[torch.dtype] = None,
  ):
      """
  
      Args:
          batch_size: batch size for hypotheses
          init_length: initial estimate for the length of hypotheses (if the real length is higher, tensors will be reallocated)
          device: device for storing hypotheses
          float_dtype: float type for scores
      """
      if init_length <= 0:
          raise ValueError(
              f"init_length must be > 0, got {init_length}"
          )
      if batch_size <= 0:
          raise ValueError(f"batch_size must be > 0, got {batch_size}")
      self._max_length = init_length
  
      # batch of current lengths of hypotheses and correspoinding timesteps
      self.current_lengths = torch.zeros(
          batch_size, device=device, dtype=torch.long
      )
      # tensor for storing transcripts
      self.transcript = torch.zeros(
          (batch_size, self._max_length),
          device=device,
          dtype=torch.long,
      )
      # tensor for storing timesteps corresponding to transcripts
      self.timesteps = torch.zeros(
          (batch_size, self._max_length),
          device=device,
          dtype=torch.long,
      )
      # accumulated scores for hypotheses
      self.scores = torch.zeros(
          batch_size, device=device, dtype=float_dtype
      )
  
      # tracking last timestep of each hyp to avoid infinite looping (when max symbols per frame is restricted)
      # last observed timestep (with label) for each hypothesis
      self.last_timestep = torch.full(
          (batch_size,), -1, device=device, dtype=torch.long
      )
      # number of labels for the last timestep
      self.last_timestep_lasts = torch.zeros(
          batch_size, device=device, dtype=torch.long
      )
  
file_path: NeMo/nemo/collections/asr/parts/utils/rnnt_utils.py
imports: from dataclasses import dataclass, field
  from typing import Any, Dict, List, Optional, Tuple, Union
  import torch
label_desc: Use image node_id 1 to create a new BatchedHyps object  with example: obj = BatchedHyps(batch_size, init_length, device, float_dtype)