code: def func(**kwvars):
      """
      Decorator for a function that registers its arguments as hyperparameters.
  
      Used for functions like: tf.cast, tf.keras.Input, tf.keras.activations.*.
      Each hyperparameter may take a fixed value or be a searchable space
      (e.g. hpo.space.Int, hpo.space.Categorical).
  
      :return: an AutoFunc object. The function body is not immediately executed at the time
               of user invocation. The actual execution is delayed until AutoFunc.sample()
               is called (usually in each trial).
      """
      from .callgraph import CallCache, CALLTYPE
  
      # def _automl_kwargs_func(**kwvars):
      #     def registered_func(func):
      #         kwspaces = OrderedDict()
  
      #         @functools.wraps(func)
      #         def wrapper_call(*args, **kwargs):
      #             _kwvars = copy.deepcopy(kwvars)
      #             _kwvars.update(kwargs)
      #             for k, v in _kwvars.items():
      #                 if isinstance(v, NestedSpace):
      #                     kwspaces[k] = v
      #                     kwargs[k] = v
      #                 elif isinstance(v, Space):
      #                     kwspaces[k] = v
      #                     hp = v.get_hp(name=k)
      #                     kwargs[k] = hp.default_value
      #                 else:
      #                     kwargs[k] = v
      #             return func(*args, **kwargs)
      #         wrapper_call.kwspaces = kwspaces
      #         return wrapper_call
      #     return registered_func
  
      def registered_func(func):
          class AutoSlice(AutoObject):
              def __init__(self, source, slice_arguments):
                  self.source = source
                  self.slice_arguments = slice_arguments
                  self._callgraph = CallCache.update(
                      (self.source, self.slice_arguments),
                      self,
                      ctype=CALLTYPE.FUNC_SLICE,
                  )
  
              def sample(self, **config):
                  slice_args, slice_kwargs = self.slice_arguments
                  return self.source.__getitem__(
                      *slice_args, **slice_kwargs
                  )
  
              @property
              def kwspaces(self):
                  return {}
  
              def __repr__(self):
                  return "AutoSlice -- [] " + str(id(self))
  
          class AutoFunc(AutoObject):
              # @_automl_kwargs_func(**kwvars)
              def __init__(self, *args, **kwargs):
                  self.func = func
                  self.args = args
                  self.kwargs = kwargs
                  self._inited = False
  
                  self.slice_args = None
                  self.slice_kwargs = None
  
                  self.kwspaces_ = OrderedDict()
                  self.kwvars = dict()
                  self._update_kw()
  
                  self._callgraph = (
                      None  # keep a reference to the call graph
                  )
                  self._callgraph = CallCache.update(
                      (self.args, self.kwargs),
                      self,
                      ctype=CALLTYPE.FUNC_CALL,
                  )
  
              def __getitem__(self, *args, **kwargs):
                  self.slice_args = args
                  self.slice_kwargs = kwargs
                  return AutoSlice(
                      self, (self.slice_args, self.slice_kwargs)
                  )
  
              def sample(self, **config):
                  kwargs = copy.deepcopy(self.kwargs)
                  # kwspaces = copy.deepcopy(AutoFunc.kwspaces)
                  kwspaces = copy.deepcopy(self.kwspaces_)
                  for k, v in kwargs.items():
                      if k in kwspaces and isinstance(
                          kwspaces[k], NestedSpace
                      ):
                          sub_config = _strip_config_space(
                              config, prefix=k
                          )
                          kwargs[k] = kwspaces[k].sample(**sub_config)
                      elif k in config:
                          kwargs[k] = config[k]
  
                  return self.func(*self.args, **kwargs)
  
              @property
              def kwspaces(self):
                  return self.kwspaces_
  
              def _update_kw(self):
                  self.kwvars.update(self.kwargs)
                  for k, v in self.kwvars.items():
                      if isinstance(v, NestedSpace):
                          self.kwspaces_[k] = v
                          self.kwargs[k] = v
                      elif isinstance(v, Space):
                          self.kwspaces_[k] = v
                          hp = v.get_hp(name=k)
                          self.kwargs[k] = hp.default_value
                      else:
                          self.kwargs[k] = v
  
              def __repr__(self):
                  return (
                      "AutoFunc -- "
                      + self.func.__name__
                      + " "
                      + str(id(self))
                  )
  
          @functools.wraps(func)
          def wrapper_call(*args, **kwargs):
              _kwvars = copy.deepcopy(kwvars)
              _kwvars.update(kwargs)
              autoobj = AutoFunc(*args, **kwargs)
              autoobj.kwvars = _kwvars
              return autoobj
  
          return wrapper_call
  
      return registered_func
  
imports: import copy
  import logging
  import argparse
  import functools
  from collections import OrderedDict
  import numpy
  import multiprocessing
  from .space import *
  from .space import _add_hp, _add_cs, _rm_hp, _strip_config_space, SPLITTER
  from .callgraph import CallCache
  from bigdl.nano.automl.utils import EasyDict
  from bigdl.nano.automl.utils import proxy_methods
  from bigdl.nano.automl.hpo.backend import create_hpo_backend
  from bigdl.nano.deps.automl.hpo_api import create_configuration_space
label_desc: Use image node_id 3 for calling a global function with example usage: func() and returns: registered_func, wrapper_call, autoobj, self, dict, unknown, AutoSlice, self, self, unknown