code: def auto_tune(args, imgs, img_nums):
      """
      Use images to auto tune the dynamic shape for trt sub graph.
      The tuned shape saved in args.auto_tuned_shape_file.
  
      Args:
          args(dict): input args.
          imgs(str, list[str]): the path for images.
          img_nums(int): the nums of images used for auto tune.
      Returns:
          None
      """
      logger.info("Auto tune the dynamic shape for GPU TRT.")
  
      assert use_auto_tune(args)
  
      if not isinstance(imgs, (list, tuple)):
          imgs = [imgs]
      num = min(len(imgs), img_nums)
  
      cfg = DeployConfig(args.cfg)
      pred_cfg = PredictConfig(cfg.model, cfg.params)
      pred_cfg.enable_use_gpu(100, 0)
      if not args.print_detail:
          pred_cfg.disable_glog_info()
      pred_cfg.collect_shape_range_info(args.auto_tuned_shape_file)
  
      predictor = create_predictor(pred_cfg)
      input_names = predictor.get_input_names()
      input_handle = predictor.get_input_handle(input_names[0])
  
      for i in range(0, num):
          data = {"img": imgs[i]}
          data = cfg.transforms(data)
          input_handle.reshape(data["img"].shape)
          input_handle.copy_from_cpu(data["img"])
          try:
              predictor.run()
          except:
              logger.info(
                  "Auto tune fail. Usually, the error is out of GPU memory, "
                  "because the model and image is too large. \n"
              )
              del predictor
              if os.path.exists(args.auto_tuned_shape_file):
                  os.remove(args.auto_tuned_shape_file)
              return
  
      logger.info("Auto tune success.\n")
  
imports: import argparse
  import codecs
  import os
  import sys
  import cv2
  import tqdm
  import yaml
  import numpy
  import paddle
  from paddle.inference import create_predictor, PrecisionType
  from paddle.inference import Config
  from paddleseg.cvlibs import manager
  from paddleseg.utils import get_sys_env, logger
  import ppmatting.transforms
  from ppmatting.utils import get_image_list, mkdir, estimate_foreground_ml, VideoReader, VideoWriter
label_desc: Use image node_id 3 for calling a global function with example usage: auto_tune(args, imgs, img_nums) without return types