code: def load_params(prog, path, ignore_params=None):
      """
      Load model from the given path.
      Args:
          prog (paddle.static.Program): Load weight to which Program object.
          path (string): Model path.
          ignore_params (list): Ignore variable to load when finetuning.
      """
      if not (
          os.path.isdir(path) or os.path.exists(path + _PDPARAMS_SUFFIX)
      ):
          raise ValueError(
              f"Model pretrain path {path} does not exists."
          )
  
      logging.info("Loading parameters from %s...", path)
  
      ignore_set = set()
      state = _load_state(path)
  
      # ignore the parameter which mismatch the shape
      # between the model and pretrain weight.
      all_var_shape = {}
      for block in prog.blocks:
          for param in block.all_parameters():
              all_var_shape[param.name] = param.shape
      ignore_set.update(
          [
              name
              for name, shape in all_var_shape.items()
              if name in state and shape != state[name].shape
          ]
      )
  
      if ignore_params:
          all_var_names = [var.name for var in prog.list_vars()]
          ignore_list = filter(
              lambda var: any(
                  [re.match(name, var) for name in ignore_params]
              ),
              all_var_names,
          )
          ignore_set.update(list(ignore_list))
  
      if len(ignore_set) > 0:
          for k in ignore_set:
              if k in state:
                  logging.warning(
                      "variable %s is already excluded automatically", k
                  )
                  del state[k]
  
      paddle.static.set_program_state(prog, state)
  
file_path: DALI/docs/examples/use_cases/paddle/resnet50/utils/save_load.py
imports: import errno
  import os
  import re
  import shutil
  import tempfile
  import logging
  import paddle
label_desc: Use image node_id 3 for calling a global function with example usage: load_params(prog, path, ignore_params) without return types