class_docstr: ASR model wrapper to perform alignment building.
  Functionality is limited to the components needed to build an alignment.
docstr: Obtains argmax predictions with corresponding probabilities.
  Replaces consecutive repeated indices in the argmax predictions with the <blank> index.
docstr_tok: ["Obtains","argmax","predictions","with","corresponding","probabilities",".","Replaces","consecutive","repeated","indices","in","the","argmax","predictions","with","the","<","blank",">","index","."]
code: def _prepare_ctc_argmax_predictions(
      self, log_probs: torch.Tensor, encoded_len: torch.Tensor
  ) -> Tuple[List[torch.Tensor], List[torch.Tensor]]:
      """Obtains argmax predictions with corresponding probabilities.
      Replaces consecutive repeated indices in the argmax predictions with the <blank> index.
      """
      if hasattr(self._model, "transcribe_decoder"):
          predictions, _, probs = self.transcribe_decoder.forward(
              log_probs=log_probs, log_probs_length=encoded_len
          )
      else:
          greedy_predictions = log_probs.argmax(dim=-1, keepdim=False)
          probs_tensor, _ = log_probs.exp().max(dim=-1, keepdim=False)
          predictions, probs = [], []
          for i in range(log_probs.shape[0]):
              utt_len = encoded_len[i]
              probs.append(probs_tensor[i, :utt_len])
              pred_candidate = greedy_predictions[i, :utt_len].cpu()
              # replace consecutive tokens with <blank>
              previous = self.blank_id
              for j in range(utt_len):
                  p = pred_candidate[j]
                  if p == previous and previous != self.blank_id:
                      pred_candidate[j] = self.blank_id
                  previous = p
              predictions.append(
                  pred_candidate.to(device=greedy_predictions.device)
              )
      return predictions, probs
  
imports: import copy
  import os
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from omegaconf import DictConfig, OmegaConf, open_dict
  from tqdm.auto import tqdm
  from nemo.collections.asr.data.audio_to_ctm_dataset import FrameCtmUnit
  from nemo.collections.asr.data.audio_to_text_dali import DALIOutputs
  from nemo.collections.asr.models.asr_model import ASRModel
  from nemo.utils import logging
label_desc: Use image node_id 7 for calling the AlignerWrapperModel obj's underlying member method code with example usage: obj._prepare_ctc_argmax_predictions(log_probs, encoded_len) and returns: predictions,  probs