class_docstr: Graph decoder with token_lm-based decoding graph.
  Available topologies:
      -   `default`, with or without self-loops
      -   `compact`, with or without self-loops
      -   `shared_blank`, with or without self-loops
      -   `minimal`, without self-loops
  
  Can do decoding and forced alignment.
  
  cfg takes precedence over all optional parameters
  We keep explicit parameter setting to be able to create an instance without the need of a config.
code: def __init__(
      self,
      num_classes: int,
      blank: int,
      cfg: Optional[DictConfig] = None,
      token_lm: Optional[Union["k2.Fsa", str]] = None,
      intersect_pruned: bool = False,
      intersect_conf: GraphIntersectDenseConfig = GraphIntersectDenseConfig(),
      topo_type: str = "default",
      topo_with_self_loops: bool = True,
      device: torch.device = torch.device("cpu"),
  ):
      super().__init__(
          num_classes,
          blank,
          cfg,
          intersect_pruned,
          intersect_conf,
          topo_type,
          topo_with_self_loops,
          device,
      )
      if cfg is not None:
          token_lm = cfg.get("token_lm", token_lm)
      if token_lm is not None:
          self.token_lm = (
              load_graph(token_lm)
              if isinstance(token_lm, str)
              else token_lm
          )
          if self.token_lm is not None:
              self.update_graph(self.token_lm)
          else:
              logging.warning(
                  f"""token_lm was set to None. Use this for debug 
                                  purposes only or call .update_graph(token_lm) before using."""
              )
      else:
          logging.warning(
              f"""token_lm was set to None. Use this for debug
                              purposes only or call .update_graph(token_lm) before using."""
          )
          self.token_lm = None
  
imports: from abc import abstractmethod
  from typing import List, Optional, Tuple, Union
  import torch
  from omegaconf import DictConfig
  from nemo.collections.asr.parts.k2.classes import GraphIntersectDenseConfig
  from nemo.collections.asr.parts.k2.loss_mixins import CtcK2Mixin, RnntK2Mixin
  from nemo.collections.asr.parts.k2.utils import invert_permutation, load_graph
  from nemo.utils import logging
label_desc: Use image node_id 1 to create a new TokenLMDecoder object from inherited base classes: BaseDecoder with example: obj = TokenLMDecoder(num_classes, blank, cfg, token_lm, intersect_pruned, intersect_conf, topo_type, topo_with__loops, device)