code: def test_greedy_decoding_preserve_alignments(self, test_data_dir):
      model, encoded, encoded_len = get_model_encoder_output(
          test_data_dir, "stt_en_conformer_transducer_small"
      )
  
      beam = greedy_decode.GreedyRNNTInfer(
          model.decoder,
          model.joint,
          blank_index=model.joint.num_classes_with_blank - 1,
          max_symbols_per_step=5,
          preserve_alignments=True,
      )
  
      enc_out = encoded
      enc_len = encoded_len
  
      with torch.no_grad():
          hyps = beam(encoder_output=enc_out, encoded_lengths=enc_len)[
              0
          ]  # type: rnnt_utils.Hypothesis
          hyp = decode_text_from_greedy_hypotheses(hyps, model.decoding)
          hyp = hyp[0]
  
          assert hyp.alignments is not None
  
          # Use the following commented print statements to check
          # the alignment of other algorithms compared to the default
          print("Text", hyp.text)
          for t in range(len(hyp.alignments)):
              t_u = []
              for u in range(len(hyp.alignments[t])):
                  logp, label = hyp.alignments[t][u]
                  assert torch.is_tensor(logp)
                  assert torch.is_tensor(label)
  
                  t_u.append(int(label))
  
              print(f"Tokens at timestep {t} = {t_u}")
          print()
  
imports: import os
  from functools import lru_cache
  import pytest
  import torch
  from omegaconf import DictConfig
  from nemo.collections.asr.models import ASRModel
  from nemo.collections.asr.modules import RNNTDecoder, RNNTJoint
  from nemo.collections.asr.parts.mixins import mixins
  from nemo.collections.asr.parts.submodules import rnnt_beam_decoding
  from nemo.collections.asr.parts.submodules import rnnt_greedy_decoding
  from nemo.collections.asr.parts.submodules.rnnt_decoding import RNNTBPEDecoding, RNNTDecoding, RNNTDecodingConfig
  from nemo.collections.asr.parts.utils import rnnt_utils
  from nemo.core.utils import numba_utils
  from nemo.core.utils.numba_utils import __NUMBA_MINIMUM_VERSION__
label_desc: Use image node_id 3 for calling the TestRNNTDecoding obj's underlying member method code with example usage: obj.test_greedy_decoding_preserve_alignments(test_data_dir) without return types