class_docstr: k2 Mixin class that simplifies the construction of various models with k2-based losses.
  
  It does the following:
      -   Sets up the graph loss and decoder (methods _init_k2 and update_k2_modules).
      -   Registers external graphs, if needed.
      -   Augments forward(...) with optional graph decoding to get accurate predictions.
class_docstr_tok: ["k2","Mixin","class","that","simplifies","the","construction","of","various","models","with","k2-based","losses",".","It","does","the","following",":","-","Sets","up","the","graph","loss","and","decoder","(","methods","_init_k2","and","update_k2_modules",")",".","-","Registers","external","graphs",",","if","needed",".","-","Augments","forward","(","...",")","with","optional","graph","decoding","to","get","accurate","predictions","."]
docstr: k2-related post-processing parf of .forward()
  
  Args:
      log_probs: The log probabilities tensor of shape [B, T, D].
      encoded_length: The lengths of the acoustic sequence after propagation through the encoder, of shape [B].
      greedy_predictions: The greedy token predictions of the model of shape [B, T]
  
  Returns:
      A tuple of 3 elements -
      1) The log probabilities tensor of shape [B, T, D].
      2) The lengths of the acoustic sequence after propagation through the encoder, of shape [B].
      3) The greedy token predictions of the model of shape [B, T] (via argmax)
docstr_tok: ["k2-related","post-processing","parf","of",".forward","(",")","Args",":","log_probs",":","The","log","probabilities","tensor","of","shape","[","B",",","T",",","D","]",".","encoded_length",":","The","lengths","of","the","acoustic","sequence","after","propagation","through","the","encoder",",","of","shape","[","B","]",".","greedy_predictions",":","The","greedy","token","predictions","of","the","model","of","shape","[","B",",","T","]","Returns",":","A","tuple","of","3","elements","-","1",")","The","log","probabilities","tensor","of","shape","[","B",",","T",",","D","]",".","2",")","The","lengths","of","the","acoustic","sequence","after","propagation","through","the","encoder",",","of","shape","[","B","]",".","3",")","The","greedy","token","predictions","of","the","model","of","shape","[","B",",","T","]","(","via","argmax",")"]
code: def _forward_k2_post_processing(
      self,
      log_probs: torch.Tensor,
      encoded_length: torch.Tensor,
      greedy_predictions: torch.Tensor,
  ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
      """
      k2-related post-processing parf of .forward()
  
      Args:
          log_probs: The log probabilities tensor of shape [B, T, D].
          encoded_length: The lengths of the acoustic sequence after propagation through the encoder, of shape [B].
          greedy_predictions: The greedy token predictions of the model of shape [B, T]
  
      Returns:
          A tuple of 3 elements -
          1) The log probabilities tensor of shape [B, T, D].
          2) The lengths of the acoustic sequence after propagation through the encoder, of shape [B].
          3) The greedy token predictions of the model of shape [B, T] (via argmax)
      """
      # greedy_predictions from .forward() are incorrect for criterion_type=`map`
      # getting correct greedy_predictions, if needed
      if self.use_graph_lm and (
          not self.training or self.transcribe_training
      ):
          (
              greedy_predictions,
              encoded_length,
              _,
          ) = self.transcribe_decoder.forward(
              log_probs=log_probs, log_probs_length=encoded_length
          )
      return log_probs, encoded_length, greedy_predictions
  
file_path: NeMo/nemo/collections/asr/parts/k2/classes.py
imports: from abc import ABC
  from dataclasses import dataclass, field
  from typing import Any, Optional, Tuple
  import torch
  from omegaconf import DictConfig
  from nemo.utils import logging
label_desc: Use image node_id 3 for calling the ASRK2Mixin obj's underlying member method code with example usage: obj._forward_k2_post_processing(log_probs, encoded_length, greedy_predictions) and returns: log_probs,  encoded_length,  greedy_predictions