code: def serialize(init):
      parameters = list(inspect.signature(init).parameters)
  
      @wraps(init)
      def new_init(self, *args, **kwargs):
          params = deepcopy(kwargs)
          for pname, value in zip(parameters[1:], args):
              params[pname] = value
  
          config = {
              "class": get_classname(self.__class__),
              "params": dict(),
          }
          specified_params = set(params.keys())
  
          for pname, param in get_default_params(
              self.__class__
          ).items():
              if pname not in params:
                  params[pname] = param.default
  
          for name, value in list(params.items()):
              param_type = "builtin"
              if inspect.isclass(value):
                  param_type = "class"
                  value = get_classname(value)
  
              config["params"][name] = {
                  "type": param_type,
                  "value": value,
                  "specified": name in specified_params,
              }
  
          setattr(self, "_config", config)
          init(self, *args, **kwargs)
  
      return new_init
  
file_path: PaddleSeg/EISeg/eiseg/util/serialization.py
imports: from functools import wraps
  from copy import deepcopy
  import inspect
  import paddle.nn
label_desc: Use image node_id 1 for calling a global function with example usage: serialize(init) and returns: new_init