code: def update_config_dict(
      dic: dict,
      learning_rate: Optional[float] = None,
      batch_size: Optional[int] = None,
      iters: Optional[int] = None,
      to_static_training: Optional[bool] = None,
      opts: Optional[list] = None,
  ):
      """Update config"""
      # TODO: If the items to update are marked as anchors in the yaml file,
      # we should synchronize the references.
      dic = dic.copy()
  
      if learning_rate:
          dic["lr_scheduler"]["learning_rate"] = learning_rate
      if batch_size:
          dic["batch_size"] = batch_size
      if iters:
          dic["iters"] = iters
      if to_static_training:
          dic["to_static_training"] = to_static_training
  
      if opts is not None:
          for item in opts:
              assert ("=" in item) and (len(item.split("=")) == 2), (
                  "--opts params should be key=value,"
                  " such as `--opts batch_size=1 test_config.scales=0.75,1.0,1.25`, "
                  "but got ({})".format(opts)
              )
  
              key, value = item.split("=")
              if isinstance(value, six.string_types):
                  try:
                      value = literal_eval(value)
                  except ValueError:
                      pass
                  except SyntaxError:
                      pass
              key_list = key.split(".")
  
              tmp_dic = dic
              for subkey in key_list[:-1]:
                  assert (
                      subkey in tmp_dic
                  ), "Can not update {}, because it is not in config.".format(
                      key
                  )
                  tmp_dic = tmp_dic[subkey]
              tmp_dic[key_list[-1]] = value
  
      return dic
  
imports: import six
  import codecs
  import os
  from ast import literal_eval
  from typing import Any, Dict, Optional
  import yaml
  import paddle
  from paddleseg.cvlibs import config_checker
  from paddleseg.cvlibs import manager
  from paddleseg.utils import logger, utils
label_desc: Use image node_id 3 for calling a global function with example usage: update_config_dict(dic, learning_rate, batch_size, iters, to_static_training, opts) and returns: dic