class_docstr: A Config which contains the method name and settings to compute per-frame confidence scores.
  
  Args:
      name: The method name (str).
          Supported values:
              - 'max_prob' for using the maximum token probability as a confidence.
              - 'entropy' for using a normalized entropy of a log-likelihood vector.
  
      entropy_type: Which type of entropy to use (str).
          Used if confidence_method_cfg.name is set to `entropy`.
          Supported values:
              - 'gibbs' for the (standard) Gibbs entropy. If the alpha (α) is provided,
                  the formula is the following: H_α = -sum_i((p^α_i)*log(p^α_i)).
                  Note that for this entropy, the alpha should comply the following inequality:
                  (log(V)+2-sqrt(log^2(V)+4))/(2*log(V)) <= α <= (1+log(V-1))/log(V-1)
                  where V is the model vocabulary size.
              - 'tsallis' for the Tsallis entropy with the Boltzmann constant one.
                  Tsallis entropy formula is the following: H_α = 1/(α-1)*(1-sum_i(p^α_i)),
                  where α is a parameter. When α == 1, it works like the Gibbs entropy.
                  More: https://en.wikipedia.org/wiki/Tsallis_entropy
              - 'renyi' for the Rényi entropy.
                  Rényi entropy formula is the following: H_α = 1/(1-α)*log_2(sum_i(p^α_i)),
                  where α is a parameter. When α == 1, it works like the Gibbs entropy.
                  More: https://en.wikipedia.org/wiki/R%C3%A9nyi_entropy
  
      alpha: Power scale for logsoftmax (α for entropies). Here we restrict it to be > 0.
          When the alpha equals one, scaling is not applied to 'max_prob',
          and any entropy type behaves like the Shannon entropy: H = -sum_i(p_i*log(p_i))
  
      entropy_norm: A mapping of the entropy value to the interval [0,1].
          Supported values:
              - 'lin' for using the linear mapping.
              - 'exp' for using exponential mapping with linear shift.
class_docstr_tok: ["A","Config","which","contains","the","method","name","and","settings","to","compute","per-frame","confidence","scores",".","Args",":","name",":","The","method","name","(","str",")",".","Supported","values",":","-","'max_prob","'","for","using","the","maximum","token","probability","as","a","confidence",".","-","'entropy","'","for","using","a","normalized","entropy","of","a","log-likelihood","vector",".","entropy_type",":","Which","type","of","entropy","to","use","(","str",")",".","Used","if","confidence_method_cfg.name","is","set","to","`","entropy","`",".","Supported","values",":","-","'gibbs","'","for","the","(","standard",")","Gibbs","entropy",".","If","the","alpha","(","\u03b1",")","is","provided",",","the","formula","is","the","following",":","H_\u03b1","=","-sum_i","(","(","p^\u03b1_i",")","*","log","(","p^\u03b1_i",")",")",".","Note","that","for","this","entropy",",","the","alpha","should","comply","the","following","inequality",":","(","log","(","V",")","+2-sqrt","(","log^2","(","V",")","+4",")",")","\/","(","2","*","log","(","V",")",")","<","=","\u03b1","<","=","(","1+log","(","V-1",")",")","\/log","(","V-1",")","where","V","is","the","model","vocabulary","size",".","-","'tsallis","'","for","the","Tsallis","entropy","with","the","Boltzmann","constant","one",".","Tsallis","entropy","formula","is","the","following",":","H_\u03b1","=","1\/","(","\u03b1-1",")","*","(","1-sum_i","(","p^\u03b1_i",")",")",",","where","\u03b1","is","a","parameter",".","When","\u03b1","==","1",",","it","works","like","the","Gibbs","entropy",".","More",":","https",":","\/\/en.wikipedia.org\/wiki\/Tsallis_entropy","-","'renyi","'","for","the","R\u00e9nyi","entropy",".","R\u00e9nyi","entropy","formula","is","the","following",":","H_\u03b1","=","1\/","(","1-\u03b1",")","*","log_2","(","sum_i","(","p^\u03b1_i",")",")",",","where","\u03b1","is","a","parameter",".","When","\u03b1","==","1",",","it","works","like","the","Gibbs","entropy",".","More",":","https",":","\/\/en.wikipedia.org\/wiki\/R","%","C3","%","A9nyi_entropy","alpha",":","Power","scale","for","logsoftmax","(","\u03b1","for","entropies",")",".","Here","we","restrict","it","to","be",">","0",".","When","the","alpha","equals","one",",","scaling","is","not","applied","to","'max_prob","'",",","and","any","entropy","type","behaves","like","the","Shannon","entropy",":","H","=","-sum_i","(","p_i","*","log","(","p_i",")",")","entropy_norm",":","A","mapping","of","the","entropy","value","to","the","interval","[","0,1","]",".","Supported","values",":","-","'lin","'","for","using","the","linear","mapping",".","-","'exp","'","for","using","exponential","mapping","with","linear","shift","."]
code: def __post_init__(self):
      if self.temperature != "DEPRECATED":
          # self.temperature has type str
          self.alpha = float(self.temperature)
          self.temperature = "DEPRECATED"
      if self.name not in ConfidenceMethodConstants.NAMES:
          raise ValueError(
              f"`name` must be one of the following: "
              f"{'`' + '`, `'.join(ConfidenceMethodConstants.NAMES) + '`'}. Provided: `{self.name}`"
          )
      if (
          self.entropy_type
          not in ConfidenceMethodConstants.ENTROPY_TYPES
      ):
          raise ValueError(
              f"`entropy_type` must be one of the following: "
              f"{'`' + '`, `'.join(ConfidenceMethodConstants.ENTROPY_TYPES) + '`'}. Provided: `{self.entropy_type}`"
          )
      if self.alpha <= 0.0:
          raise ValueError(
              f"`alpha` must be > 0. Provided: {self.alpha}"
          )
      if (
          self.entropy_norm
          not in ConfidenceMethodConstants.ENTROPY_NORMS
      ):
          raise ValueError(
              f"`entropy_norm` must be one of the following: "
              f"{'`' + '`, `'.join(ConfidenceMethodConstants.ENTROPY_NORMS) + '`'}. Provided: `{self.entropy_norm}`"
          )
  
imports: import math
  from abc import ABC, abstractmethod
  from dataclasses import dataclass, field
  from functools import partial
  from typing import List, Optional
  import torch
  from omegaconf import DictConfig, OmegaConf
  from nemo.collections.asr.parts.utils.rnnt_utils import Hypothesis
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling the ConfidenceMethodConfig obj's underlying member method code with example usage: obj.__post_init__() without return types