class_docstr: Maximum Likelihood criterion.
  It implements Connectionist Temporal Classification (CTC) loss,
  but can be extended to support other loss functions (ASG, HMM, RNNT, ...).
  
  Based on https://github.com/k2-fsa/snowfall/blob/master/snowfall/objectives/ctc.py
  
  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.
docstr: Converts input tensors to FST graphs:
      log_probs to supervision_graphs (DenseFsaVec)
      targets to supervision_graphs
  Can be overridden.
docstr_tok: ["Converts","input","tensors","to","FST","graphs",":","log_probs","to","supervision_graphs","(","DenseFsaVec",")","targets","to","supervision_graphs","Can","be","overridden","."]
code: def _prepare_graphs_for_intersection(
      self,
      log_probs: torch.Tensor,
      targets: torch.Tensor,
      input_lengths: torch.Tensor,
      target_lengths: torch.Tensor,
  ) -> Tuple["k2.DenseFsaVec", Any, torch.Tensor]:
      """Converts input tensors to FST graphs:
          log_probs to supervision_graphs (DenseFsaVec)
          targets to supervision_graphs
      Can be overridden.
      """
      (
          log_probs,
          supervisions,
          targets,
          target_lengths,
      ) = self._prepare_log_probs_and_targets(
          log_probs, input_lengths, targets, target_lengths
      )
      log_probs = self._maybe_normalize_gradients(
          log_probs, supervisions[:, -1].to(dtype=torch.long)
      )
      emissions_graphs = self._prepare_emissions_graphs(
          log_probs, supervisions
      )
      del log_probs
  
      if emissions_graphs.device != self.graph_compiler.device:
          self.graph_compiler.to(emissions_graphs.device)
      order = supervisions[:, 0].to(dtype=torch.long)
      supervision_graphs = self.graph_compiler.compile(
          targets[order], target_lengths[order]
      )
  
      return emissions_graphs, supervision_graphs, supervisions
  
imports: from abc import abstractmethod
  from typing import Any, Optional, Tuple
  import torch
  from omegaconf import DictConfig
  from nemo.collections.asr.parts.k2.graph_compilers import CtcTopologyCompiler, RnntTopologyCompiler
  from nemo.collections.asr.parts.k2.loss_mixins import CtcK2Mixin, RnntK2Mixin
  from nemo.collections.asr.parts.k2.utils import get_tot_objf_and_finite_mask, invert_permutation
  from nemo.core.utils.k2_guard import k2
label_desc: Use image node_id 2 for calling the MLLoss obj's underlying member method code with example usage: obj._prepare_graphs_for_intersection(log_probs, targets, input_lengths, target_lengths) and returns: emissions_graphs,  supervision_graphs,  supervisions