code: def load_predictor(args):
      """
      load predictor func
      """
      rerun_flag = False
      model_file = os.path.join(args.model_path, args.model_filename)
      params_file = os.path.join(args.model_path, args.params_filename)
      pred_cfg = PredictConfig(model_file, params_file)
      pred_cfg.enable_memory_optim()
      pred_cfg.switch_ir_optim(True)
      if args.device == "GPU":
          pred_cfg.enable_use_gpu(100, 0)
      else:
          pred_cfg.disable_gpu()
          pred_cfg.set_cpu_math_library_num_threads(args.cpu_threads)
          if args.use_mkldnn:
              pred_cfg.enable_mkldnn()
              if args.precision == "int8":
                  # Please ensure that the quantized ops during inference are the same as
                  # the ops set in the qat training configuration file
                  pred_cfg.enable_mkldnn_int8(
                      {"conv2d", "depthwise_conv2d"}
                  )
  
      if args.use_trt:
          # To collect the dynamic shapes of inputs for TensorRT engine
          dynamic_shape_file = os.path.join(
              args.model_path, "dynamic_shape.txt"
          )
          if os.path.exists(dynamic_shape_file):
              pred_cfg.enable_tuned_tensorrt_dynamic_shape(
                  dynamic_shape_file, True
              )
              # pred_cfg.exp_disable_tensorrt_ops(["reshape2"])
              print("trt set dynamic shape done!")
              precision_map = {
                  "fp16": PrecisionType.Half,
                  "fp32": PrecisionType.Float32,
                  "int8": PrecisionType.Int8,
              }
              pred_cfg.enable_tensorrt_engine(
                  workspace_size=1 << 30,
                  max_batch_size=1,
                  min_subgraph_size=4,
                  precision_mode=precision_map[args.precision],
                  use_static=True,
                  use_calib_mode=False,
              )
          else:
              pred_cfg.disable_gpu()
              pred_cfg.set_cpu_math_library_num_threads(10)
              pred_cfg.collect_shape_range_info(dynamic_shape_file)
              print("Start collect dynamic shape...")
              rerun_flag = True
  
      pred_cfg.exp_disable_tensorrt_ops(["reshape2"])
      # pred_cfg.delete_pass("gpu_cpu_map_matmul_v2_to_mul_pass")
      # pred_cfg.delete_pass("delete_quant_dequant_linear_op_pass")
      # pred_cfg.delete_pass("delete_weight_dequant_linear_op_pass")
      predictor = create_predictor(pred_cfg)
      return predictor, rerun_flag
  
file_path: PaddleSeg/deploy/slim/act/test_seg.py
imports: import argparse
  import time
  import os
  import sys
  import cv2
  import numpy
  import paddle
  import paddleseg.transforms
  from paddleseg.cvlibs import Config
  from paddleseg.core.infer import reverse_transform
  from paddleseg.utils.visualize import get_pseudo_color_map
  from paddleseg.utils import metrics
  from paddleseg.cvlibs import SegBuilder
  from paddle.inference import create_predictor, PrecisionType
  from paddle.inference import Config
label_desc: Use image node_id 2 for calling a global function with example usage: load_predictor(args) and returns: predictor,  rerun_flag