def prepare_config()

in mtrl/experiment/experiment.py [0:0]


def prepare_config(config: ConfigType, env_metadata: EnvMetaDataType) -> ConfigType:
    """Infer some config attributes during runtime.

    Args:
        config (ConfigType): config to update.
        env_metadata (EnvMetaDataType): metadata of the environment.

    Returns:
        ConfigType: updated config.
    """
    config = config_utils.make_config_mutable(config_utils.unset_struct(config))
    key = "type_to_select"
    if key in config.agent.encoder:
        encoder_type_to_select = config.agent.encoder[key]
        # config.agent.encoder = config.agent.encoder[encoder_type_to_select]
    else:
        encoder_type_to_select = config.agent.encoder.type
    if encoder_type_to_select in ["identity"]:
        # if the encoder is an identity encoder infer the shape of the input dim.
        config.agent.encoder_feature_dim = env_metadata["env_obs_space"].shape[0]

    key = "ordered_task_list"
    if key in env_metadata and env_metadata[key]:
        config.env.ordered_task_list = deepcopy(env_metadata[key])
    config = config_utils.make_config_immutable(config)

    return config