code: def main(args):
      fp32_model_dir = args.model_dir
      quant_output_dir = "quant_model"
  
      cfg = Config(args.cfg, opts=args.opts)
      builder = SegBuilder(cfg)
  
      val_dataset = builder.val_dataset
  
      use_gpu = True
      place = paddle.CUDAPlace(0) if use_gpu else paddle.CPUPlace()
      exe = paddle.static.Executor(place)
  
      data_loader = paddle.io.DataLoader(
          val_dataset,
          places=place,
          drop_last=False,
          batch_size=1,
          shuffle=False,
      )
  
      quant_post_static(
          executor=exe,
          model_dir=fp32_model_dir,
          quantize_model_path=quant_output_dir,
          save_model_filename="model.pdmodel",
          save_params_filename="model.pdiparams",
          sample_generator=sample_generator(data_loader),
          model_filename="model.pdmodel",
          params_filename="model.pdiparams",
          batch_size=args.batch_size,
          batch_nums=args.batch_nums,
          algo="KL",
      )
  
      # copy yml
      shutil.copyfile(
          os.path.join(fp32_model_dir, "deploy.yaml"),
          os.path.join(quant_output_dir, "deploy.yaml"),
      )
  
file_path: PaddleSeg/deploy/slim/quant/ptq.py
imports: import argparse
  import os
  import numpy
  import shutil
  import paddle
  from paddleslim.quant import quant_post_static
  from paddleseg.cvlibs import Config, SegBuilder
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types