code: def trt_inference(
      stream,
      trt_ctx,
      d_input,
      d_output,
      input_signal,
      input_signal_length,
  ):
      print("infer with shape: {}".format(input_signal.shape))
  
      trt_ctx.set_binding_shape(0, input_signal.shape)
      assert trt_ctx.all_binding_shapes_specified
  
      h_output = cuda.pagelocked_empty(
          tuple(trt_ctx.get_binding_shape(1)), dtype=np.float32
      )
  
      h_input_signal = cuda.register_host_memory(
          np.ascontiguousarray(input_signal.cpu().numpy().ravel())
      )
      cuda.memcpy_htod_async(d_input, h_input_signal, stream)
      trt_ctx.execute_async_v2(
          bindings=[int(d_input), int(d_output)],
          stream_handle=stream.handle,
      )
      cuda.memcpy_dtoh_async(h_output, d_output, stream)
      stream.synchronize()
  
      greedy_predictions = torch.tensor(h_output).argmax(
          dim=-1, keepdim=False
      )
      return greedy_predictions
  
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 4 for calling a global function with example usage: trt_inference(stream, trt_ctx, d_input, d_output, input_signal, input_signal_length) and returns: greedy_predictions