ml_collections.config_dict.recursive_rename

ml_collections.config_dict.recursive_rename(conf, old_name, new_name)[source]

Returns copy of conf with old_name recursively replaced by new_name.

This is not done in place, no changes are made to conf but a new ConfigDict is returned with the changes made. This is useful if the name of a parameter has been changed in code but you need to load an old config.

Example usage:
updated_conf = configdict.recursive_rename(conf, “config”, “kwargs”)
Parameters:
  • conf – a ConfigDict which needs updating
  • old_name – the name used in the ConfigDict which is out of sync with the code
  • new_name – the name used in the code
Returns:

A ConfigDict which is a copy of conf but with all instances of old_name replaced with new_name.