code: def build_trt_engine(asr_model, onnx_path, qat):
      trt_engine_path = "{}.trt".format(onnx_path)
      if os.path.exists(trt_engine_path):
          return trt_engine_path
  
      min_input_shape, max_input_shape = get_min_max_input_shape(
          asr_model
      )
      workspace_size = 512
      with trt.Builder(TRT_LOGGER) as builder:
          network_flags = 1 << int(
              trt.NetworkDefinitionCreationFlag.EXPLICIT_BATCH
          )
          if qat:
              network_flags |= 1 << int(
                  trt.NetworkDefinitionCreationFlag.EXPLICIT_PRECISION
              )
          with builder.create_network(
              flags=network_flags
          ) as network, trt.OnnxParser(
              network, TRT_LOGGER
          ) as parser, builder.create_builder_config() as builder_config:
              parser.parse_from_file(onnx_path)
              builder_config.max_workspace_size = workspace_size * (
                  1024 * 1024
              )
              if qat:
                  builder_config.set_flag(trt.BuilderFlag.INT8)
  
              profile = builder.create_optimization_profile()
              profile.set_shape(
                  "audio_signal",
                  min=min_input_shape,
                  opt=max_input_shape,
                  max=max_input_shape,
              )
              builder_config.add_optimization_profile(profile)
  
              engine = builder.build_engine(network, builder_config)
              serialized_engine = engine.serialize()
              with open(trt_engine_path, "wb") as fout:
                  fout.write(serialized_engine)
      return trt_engine_path
  
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 3 for calling a global function with example usage: build_trt_engine(asr_model, onnx_path, qat) and returns: trt_engine_path, trt_engine_path