class_docstr: Maximum a Posteriori Probability criterion.
  It implements Lattice-Free Maximum Mutual Information (LF-MMI) and LF-boosted-MMI (LF-bMMI) losses.
  
  Based on https://github.com/k2-fsa/snowfall/blob/master/snowfall/objectives/mmi.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: Inner intersection method.
  Does exact intersection of dense_fsa_vec against num_graphs and pruned intersection against den_graph.
  
  Optiolally returns the numerator and the denominator lattices.
docstr_tok: ["Inner","intersection","method",".","Does","exact","intersection","of","dense_fsa_vec","against","num_graphs","and","pruned","intersection","against","den_graph",".","Optiolally","returns","the","numerator","and","the","denominator","lattices","."]
code: def _intersect_calc_scores_impl_pruned(
      self,
      dense_fsa_vec: "k2.DenseFsaVec",
      num_graphs: "k2.Fsa",
      den_graph: "k2.Fsa",
      return_lats: bool = True,
  ) -> Tuple[
      torch.Tensor, torch.Tensor, Optional["k2.Fsa"], Optional["k2.Fsa"]
  ]:
      """Inner intersection method.
      Does exact intersection of dense_fsa_vec against num_graphs and pruned intersection against den_graph.
  
      Optiolally returns the numerator and the denominator lattices.
      """
      device = dense_fsa_vec.device
      assert device == num_graphs.device and device == den_graph.device
  
      num_fsas = num_graphs.shape[0]
      assert dense_fsa_vec.dim0() == num_fsas
  
      num_lats = k2.intersect_dense(
          a_fsas=num_graphs,
          b_fsas=dense_fsa_vec,
          output_beam=self.intersect_conf.output_beam,
          seqframe_idx_name="seqframe_idx" if return_lats else None,
      )
      den_lats = k2.intersect_dense_pruned(
          a_fsas=den_graph,
          b_fsas=dense_fsa_vec,
          search_beam=self.intersect_conf.search_beam,
          output_beam=self.intersect_conf.output_beam,
          min_active_states=self.intersect_conf.min_active_states,
          max_active_states=self.intersect_conf.max_active_states,
          seqframe_idx_name="seqframe_idx" if return_lats else None,
      )
  
      num_tot_scores = num_lats.get_tot_scores(
          log_semiring=True, use_double_scores=False
      )
      den_tot_scores = den_lats.get_tot_scores(
          log_semiring=True, use_double_scores=False
      )
  
      if return_lats:
          return num_tot_scores, den_tot_scores, num_lats, den_lats
      else:
          return num_tot_scores, den_tot_scores, None, None
  
imports: from abc import abstractmethod
  from typing import Any, 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
  from nemo.collections.asr.parts.k2.ml_loss import MLLoss
  from nemo.collections.asr.parts.k2.utils import create_sparse_wrapped, get_tot_objf_and_finite_mask, invert_permutation, load_graph
  from nemo.core.utils.k2_guard import k2
  from nemo.utils import logging
label_desc: Use image node_id 4 for calling the MAPLoss obj's underlying member method code with example usage: obj._intersect_calc_scores_impl_pruned(dense_fsa_vec, num_graphs, den_graph, return_lats) and returns: num_tot_scores,  den_tot_scores,  num_lats,  den_lats, num_tot_scores,  den_tot_scores,  None,  None