code: def create_optimizer(params):
      r"""Creates a config-driven optimizer."""
      params = filter(lambda p: p.requires_grad, params)
      # Try to load customized optimizer
      for func in register.optimizer_dict.values():
          optimizer = func(params)
          if optimizer is not None:
              return optimizer
      if cfg.optim.optimizer == "adam":
          optimizer = optim.Adam(
              params,
              lr=cfg.optim.base_lr,
              weight_decay=cfg.optim.weight_decay,
          )
      elif cfg.optim.optimizer == "sgd":
          optimizer = optim.SGD(
              params,
              lr=cfg.optim.base_lr,
              momentum=cfg.optim.momentum,
              weight_decay=cfg.optim.weight_decay,
          )
      else:
          raise ValueError(
              "Optimizer {} not supported".format(cfg.optim.optimizer)
          )
  
      return optimizer
  
imports: import torch.optim
  import graphgym.register
  from graphgym.config import cfg
label_desc: Use image node_id 1 for calling a global function with example usage: create_optimizer(params) and returns: optimizer, optimizer