code: def evaluate(asr_model, asr_onnx, labels_map, wer, qat):
      # Eval the model
      hypotheses = []
      references = []
      stream = cuda.Stream()
      vocabulary_size = len(labels_map) + 1
      engine_file_path = build_trt_engine(asr_model, asr_onnx, qat)
      with open(engine_file_path, "rb") as f, trt.Runtime(
          TRT_LOGGER
      ) as runtime:
          trt_engine = runtime.deserialize_cuda_engine(f.read())
          trt_ctx = trt_engine.create_execution_context()
  
          profile_shape = trt_engine.get_profile_shape(
              profile_index=0, binding=0
          )
          print(
              "profile shape min:{}, opt:{}, max:{}".format(
                  profile_shape[0], profile_shape[1], profile_shape[2]
              )
          )
          max_input_shape = profile_shape[2]
          input_nbytes = (
              trt.volume(max_input_shape) * trt.float32.itemsize
          )
          d_input = cuda.mem_alloc(input_nbytes)
          max_output_shape = [
              max_input_shape[0],
              vocabulary_size,
              (max_input_shape[-1] + 1) // 2,
          ]
          output_nbytes = (
              trt.volume(max_output_shape) * trt.float32.itemsize
          )
          d_output = cuda.mem_alloc(output_nbytes)
  
          for test_batch in asr_model.test_dataloader():
              if can_gpu:
                  test_batch = [x.cuda() for x in test_batch]
              (
                  processed_signal,
                  processed_signal_length,
              ) = asr_model.preprocessor(
                  input_signal=test_batch[0], length=test_batch[1]
              )
  
              greedy_predictions = trt_inference(
                  stream,
                  trt_ctx,
                  d_input,
                  d_output,
                  input_signal=processed_signal,
                  input_signal_length=processed_signal_length,
              )
              hypotheses += wer.decoding.ctc_decoder_predictions_tensor(
                  greedy_predictions
              )[0]
              for batch_ind in range(greedy_predictions.shape[0]):
                  seq_len = (
                      test_batch[3][batch_ind].cpu().detach().numpy()
                  )
                  seq_ids = (
                      test_batch[2][batch_ind].cpu().detach().numpy()
                  )
                  reference = "".join(
                      [labels_map[c] for c in seq_ids[0:seq_len]]
                  )
                  references.append(reference)
              del test_batch
          wer_value = word_error_rate(
              hypotheses=hypotheses,
              references=references,
              use_cer=wer.use_cer,
          )
  
      return wer_value
  
file_path: NeMo/examples/asr/quantization/speech_to_text_quant_infer_trt.py
imports: import os
  from argparse import ArgumentParser
  import numpy
  import pycuda.driver
  import tensorrt
  import torch
  from omegaconf import open_dict
  from nemo.collections.asr.metrics.wer import WER, word_error_rate
  from nemo.collections.asr.models import EncDecCTCModel
  from nemo.collections.asr.parts.submodules.ctc_decoding import CTCDecoding, CTCDecodingConfig
  from nemo.utils import logging
label_desc: Use image node_id 5 for calling a global function with example usage: evaluate(asr_model, asr_onnx, labels_map, wer, qat) and returns: wer_value