class_docstr: Base graph decoder with topology for decoding graph.
  Typically uses the same parameters as for the corresponding loss function.
  
  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,
      intersect_pruned: bool = False,
      intersect_conf: GraphIntersectDenseConfig = GraphIntersectDenseConfig(),
      topo_type: str = "default",
      topo_with_self_loops: bool = True,
      device: torch.device = torch.device("cpu"),
  ):
      if cfg is not None:
          intersect_pruned = cfg.get(
              "intersect_pruned", intersect_pruned
          )
          intersect_conf = cfg.get("intersect_conf", intersect_conf)
          topo_type = cfg.get("topo_type", topo_type)
          topo_with_self_loops = cfg.get(
              "topo_with_self_loops", topo_with_self_loops
          )
  
      self.num_classes = num_classes
      self.blank = blank
      self.intersect_pruned = intersect_pruned
      self.device = device
      self.topo_type = topo_type
      self.topo_with_self_loops = topo_with_self_loops
      self.pad_fsavec = self.topo_type == "ctc_compact"
      self.intersect_conf = intersect_conf
      self.graph_compiler = (
          None  # expected to be initialized in child classes
      )
      self.base_graph = (
          None  # expected to be initialized in child classes
      )
      self.decoding_graph = 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 BaseDecoder object from inherited base classes: object with example: obj = BaseDecoder(num_classes, blank, cfg, intersect_pruned, intersect_conf, topo_type, topo_with__loops, device)