code: def export_with_args(args):
      if args.cfg is None:
          raise RuntimeError(
              "No configuration file has been specified."
          )
      cfg = Config(args.cfg)
      builder = make_default_builder(cfg)
  
      utils.show_env_info()
      utils.show_cfg_info(cfg)
      os.environ["PADDLESEG_EXPORT_STAGE"] = "True"
  
      net = builder.model
      postprocessor = builder.postprocessor
  
      if args.model_path is not None:
          para_state_dict = paddle.load(args.model_path)
          net.set_dict(para_state_dict)
          logger.info("Params are successfully loaded.")
  
      if args.input_shape is None:
          shape = [None, 3, None, None]
      else:
          shape = args.input_shape
  
      net = WrappedPanSegInferModel(net, postprocessor)
      net.eval()
      net = paddle.jit.to_static(
          net,
          input_spec=[
              paddle.static.InputSpec(shape=shape, dtype="float32")
          ],
      )
  
      save_path = os.path.join(args.save_dir, "model")
      paddle.jit.save(net, save_path)
  
      yml_file = os.path.join(args.save_dir, "deploy.yaml")
      with open(yml_file, "w") as file:
          transforms = cfg.export_cfg.get("transforms", [])
          data = {
              "Deploy": {
                  "model": "model.pdmodel",
                  "params": "model.pdiparams",
                  "transforms": transforms,
                  "input_shape": shape,
              }
          }
          yaml.dump(data, file)
  
      logger.info(
          f"The inference model is exported to {args.save_dir}."
      )
  
file_path: PaddleSeg/contrib/PanopticSeg/tools/export.py
imports: import argparse
  import os
  import paddle
  import yaml
  from paddleseg.utils import logger, utils
  from paddlepanseg.cvlibs import Config, make_default_builder
  from paddlepanseg.deploy.export import WrappedPanSegInferModel
label_desc: Use image node_id 2 for calling a global function with example usage: export_with_args(args) without return types