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: Add results (inplace) from a decoding step to the batched hypotheses
  Args:
      active_indices: tensor with indices of active hypotheses (indices should be within the original batch_size)
      labels: non-blank labels to add
      time_indices: tensor of time index for each label
      scores: label scores
docstr_tok: ["Add","results","(","inplace",")","from","a","decoding","step","to","the","batched","hypotheses","Args",":","active_indices",":","tensor","with","indices","of","active","hypotheses","(","indices","should","be","within","the","original","batch_size",")","labels",":","non-blank","labels","to","add","time_indices",":","tensor","of","time","index","for","each","label","scores",":","label","scores"]
code: def add_results_(
      self,
      active_indices: torch.Tensor,
      labels: torch.Tensor,
      time_indices: torch.Tensor,
      scores: torch.Tensor,
  ):
      """
      Add results (inplace) from a decoding step to the batched hypotheses
      Args:
          active_indices: tensor with indices of active hypotheses (indices should be within the original batch_size)
          labels: non-blank labels to add
          time_indices: tensor of time index for each label
          scores: label scores
      """
      # we assume that all tensors have the same first dimension, and labels are non-blanks
      if active_indices.shape[0] == 0:
          return  # nothing to add
      # if needed - increase storage
      if self.current_lengths.max().item() >= self._max_length:
          self._allocate_more()
  
      # accumulate scores
      self.scores[active_indices] += scores
  
      # store transcript and timesteps
      active_lengths = self.current_lengths[active_indices]
      self.transcript[active_indices, active_lengths] = labels
      self.timesteps[active_indices, active_lengths] = time_indices
      # store last observed timestep + number of observation for the current timestep
      self.last_timestep_lasts[active_indices] = torch.where(
          self.last_timestep[active_indices] == time_indices,
          self.last_timestep_lasts[active_indices] + 1,
          1,
      )
      self.last_timestep[active_indices] = time_indices
      # increase lengths
      self.current_lengths[active_indices] += 1
  
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 3 for calling the BatchedHyps obj's underlying member method code with example usage: obj.add_results_(active_indices, labels, time_indices, scores) without return types