class_docstr: Hypothesis class for beam search algorithms.
  
  score: A float score obtained from an AbstractRNNTDecoder module's score_hypothesis method.
  
  y_sequence: Either a sequence of integer ids pointing to some vocabulary, or a packed torch.Tensor
      behaving in the same manner. dtype must be torch.Long in the latter case.
  
  dec_state: A list (or list of list) of LSTM-RNN decoder states. Can be None.
  
  text: (Optional) A decoded string after processing via CTC / RNN-T decoding (removing the CTC/RNNT
      `blank` tokens, and optionally merging word-pieces). Should be used as decoded string for
      Word Error Rate calculation.
  
  timestep: (Optional) A list of integer indices representing at which index in the decoding
      process did the token appear. Should be of same length as the number of non-blank tokens.
  
  alignments: (Optional) Represents the CTC / RNNT token alignments as integer tokens along an axis of
      time T (for CTC) or Time x Target (TxU).
      For CTC, represented as a single list of integer indices.
      For RNNT, represented as a dangling list of list of integer indices.
      Outer list represents Time dimension (T), inner list represents Target dimension (U).
      The set of valid indices **includes** the CTC / RNNT blank token in order to represent alignments.
  
  frame_confidence: (Optional) Represents the CTC / RNNT per-frame confidence scores as token probabilities
      along an axis of time T (for CTC) or Time x Target (TxU).
      For CTC, represented as a single list of float indices.
      For RNNT, represented as a dangling list of list of float indices.
      Outer list represents Time dimension (T), inner list represents Target dimension (U).
  
  token_confidence: (Optional) Represents the CTC / RNNT per-token confidence scores as token probabilities
      along an axis of Target U.
      Represented as a single list of float indices.
  
  word_confidence: (Optional) Represents the CTC / RNNT per-word confidence scores as token probabilities
      along an axis of Target U.
      Represented as a single list of float indices.
  
  length: Represents the length of the sequence (the original length without padding), otherwise
      defaults to 0.
  
  y: (Unused) A list of torch.Tensors representing the list of hypotheses.
  
  lm_state: (Unused) A dictionary state cache used by an external Language Model.
  
  lm_scores: (Unused) Score of the external Language Model.
  
  ngram_lm_state: (Optional) State of the external n-gram Language Model.
  
  tokens: (Optional) A list of decoded tokens (can be characters or word-pieces.
  
  last_token (Optional): A token or batch of tokens which was predicted in the last step.
class_docstr_tok: ["Hypothesis","class","for","beam","search","algorithms",".","score",":","A","float","score","obtained","from","an","AbstractRNNTDecoder","module","'s","score_hypothesis","method",".","y_sequence",":","Either","a","sequence","of","integer","ids","pointing","to","some","vocabulary",",","or","a","packed","torch.Tensor","behaving","in","the","same","manner",".","dtype","must","be","torch.Long","in","the","latter","case",".","dec_state",":","A","list","(","or","list","of","list",")","of","LSTM-RNN","decoder","states",".","Can","be","None",".","text",":","(","Optional",")","A","decoded","string","after","processing","via","CTC","\/","RNN-T","decoding","(","removing","the","CTC\/RNNT","`","blank","`","tokens",",","and","optionally","merging","word-pieces",")",".","Should","be","used","as","decoded","string","for","Word","Error","Rate","calculation",".","timestep",":","(","Optional",")","A","list","of","integer","indices","representing","at","which","index","in","the","decoding","process","did","the","token","appear",".","Should","be","of","same","length","as","the","number","of","non-blank","tokens",".","alignments",":","(","Optional",")","Represents","the","CTC","\/","RNNT","token","alignments","as","integer","tokens","along","an","axis","of","time","T","(","for","CTC",")","or","Time","x","Target","(","TxU",")",".","For","CTC",",","represented","as","a","single","list","of","integer","indices",".","For","RNNT",",","represented","as","a","dangling","list","of","list","of","integer","indices",".","Outer","list","represents","Time","dimension","(","T",")",",","inner","list","represents","Target","dimension","(","U",")",".","The","set","of","valid","indices","*","*","includes","*","*","the","CTC","\/","RNNT","blank","token","in","order","to","represent","alignments",".","frame_confidence",":","(","Optional",")","Represents","the","CTC","\/","RNNT","per-frame","confidence","scores","as","token","probabilities","along","an","axis","of","time","T","(","for","CTC",")","or","Time","x","Target","(","TxU",")",".","For","CTC",",","represented","as","a","single","list","of","float","indices",".","For","RNNT",",","represented","as","a","dangling","list","of","list","of","float","indices",".","Outer","list","represents","Time","dimension","(","T",")",",","inner","list","represents","Target","dimension","(","U",")",".","token_confidence",":","(","Optional",")","Represents","the","CTC","\/","RNNT","per-token","confidence","scores","as","token","probabilities","along","an","axis","of","Target","U",".","Represented","as","a","single","list","of","float","indices",".","word_confidence",":","(","Optional",")","Represents","the","CTC","\/","RNNT","per-word","confidence","scores","as","token","probabilities","along","an","axis","of","Target","U",".","Represented","as","a","single","list","of","float","indices",".","length",":","Represents","the","length","of","the","sequence","(","the","original","length","without","padding",")",",","otherwise","defaults","to","0.","y",":","(","Unused",")","A","list","of","torch.Tensors","representing","the","list","of","hypotheses",".","lm_state",":","(","Unused",")","A","dictionary","state","cache","used","by","an","external","Language","Model",".","lm_scores",":","(","Unused",")","Score","of","the","external","Language","Model",".","ngram_lm_state",":","(","Optional",")","State","of","the","external","n-gram","Language","Model",".","tokens",":","(","Optional",")","A","list","of","decoded","tokens","(","can","be","characters","or","word-pieces",".","last_token","(","Optional",")",":","A","token","or","batch","of","tokens","which","was","predicted","in","the","last","step","."]
docstr: Get per-frame confidence for non-blank tokens according to self.timestep
  
  Returns:
      List with confidence scores. The length of the list is the same as `timestep`.
docstr_tok: ["Get","per-frame","confidence","for","non-blank","tokens","according","to","self.timestep","Returns",":","List","with","confidence","scores",".","The","length","of","the","list","is","the","same","as","`","timestep","`","."]
code: def non_blank_frame_confidence(self) -> List[float]:
      """Get per-frame confidence for non-blank tokens according to self.timestep
  
      Returns:
          List with confidence scores. The length of the list is the same as `timestep`.
      """
      non_blank_frame_confidence = []
      # self.timestep can be a dict for RNNT
      timestep = (
          self.timestep["timestep"]
          if isinstance(self.timestep, dict)
          else self.timestep
      )
      if len(self.timestep) != 0 and self.frame_confidence is not None:
          if any(
              isinstance(i, list) for i in self.frame_confidence
          ):  # rnnt
              t_prev = -1
              offset = 0
              for t in timestep:
                  if t != t_prev:
                      t_prev = t
                      offset = 0
                  else:
                      offset += 1
                  non_blank_frame_confidence.append(
                      self.frame_confidence[t][offset]
                  )
          else:  # ctc
              non_blank_frame_confidence = [
                  self.frame_confidence[t] for t in timestep
              ]
      return non_blank_frame_confidence
  
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 for calling the Hypothesis obj's underlying member method code with example usage: obj.non_blank_frame_confidence() and returns: non_blank_frame_confidence