code: def create_trt_bindings(engine, context):
      bindings = OrderedDict()
      for name in engine:
          binding_idx = engine.get_binding_index(name)
          size = trt.volume(context.get_binding_shape(binding_idx))
          dtype = trt.nptype(engine.get_binding_dtype(name))
          shape = list(engine.get_binding_shape(binding_idx))
          if shape[0] == -1:
              shape[0] = 1
          bindings[name] = {
              "idx": binding_idx,
              "size": size,
              "dtype": dtype,
              "shape": shape,
              "cpu_data": None,
              "cuda_ptr": None,
              "is_input": True
              if engine.binding_is_input(name)
              else False,
          }
          if engine.binding_is_input(name):
              bindings[name]["cpu_data"] = np.random.randn(
                  *shape
              ).astype(np.float32)
              bindings[name]["cuda_ptr"] = cuda.mem_alloc(
                  bindings[name]["cpu_data"].nbytes
              )
          else:
              bindings[name]["cpu_data"] = cuda.pagelocked_empty(
                  size, dtype
              )
              bindings[name]["cuda_ptr"] = cuda.mem_alloc(
                  bindings[name]["cpu_data"].nbytes
              )
      return bindings
  
imports: import time
  import numpy
  import pycuda.autoinit
  import pycuda.driver
  import tensorrt
  from collections import OrderedDict
  import os
  import yaml
  import json
  import glob
  import argparse
  from preprocess import Compose
  from preprocess import coco_clsid2catid
label_desc: Use image node_id 4 for calling a global function with example usage: create_trt_bindings(engine, context) and returns: bindings