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: Intersects emissions_graphs with supervision_graphs and calculates lattice scores.
  Can be overridden.
docstr_tok: ["Intersects","emissions_graphs","with","supervision_graphs","and","calculates","lattice","scores",".","Can","be","overridden","."]
code: def _intersect_calc_scores(
      self,
      emissions_graphs: "k2.DenseFsaVec",
      supervision_graphs: Any,
      supervisions: torch.Tensor,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      """Intersects emissions_graphs with supervision_graphs and calculates lattice scores.
      Can be overridden.
      """
      lats = k2.intersect_dense(
          supervision_graphs,
          emissions_graphs,
          torch.finfo(torch.float32).max / 10,
      )
      del emissions_graphs
  
      num_tot_scores = lats.get_tot_scores(
          log_semiring=True, use_double_scores=False
      )
      del lats
      tot_scores = num_tot_scores[
          invert_permutation(supervisions[:, 0].to(dtype=torch.long))
      ]
      tot_scores, valid_mask = get_tot_objf_and_finite_mask(
          tot_scores, self.reduction
      )
      return (
          -tot_scores[valid_mask]
          if self.reduction == "none"
          else -tot_scores,
          valid_mask,
      )
  
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 3 for calling the MLLoss obj's underlying member method code with example usage: obj._intersect_calc_scores(emissions_graphs, supervision_graphs, supervisions) and returns: unknown,  valid_mask