def get_model(type_, name_): if type_ == "ac": from genrl.deep.common.actor_critic import get_actor_critic_from_name return get_actor_critic_from_name(name_) elif type_ == "v": from genrl.deep.common.values import get_value_from_name return get_value_from_name(name_) elif type_ == "p": from genrl.deep.common.policies import get_policy_from_name return get_policy_from_name(name_) raise ValueError
def get_model(type_: str, name_: str) -> Union: """ Utility to get the class of required function :param type_: "ac" for Actor Critic, "v" for Value, "p" for Policy :param name_: Name of the specific structure of model. ( Eg. "mlp" or "cnn") :type type_: string :type name_: string :returns: Required class. Eg. MlpActorCritic """ if type_ == "ac": from genrl.deep.common.actor_critic import get_actor_critic_from_name return get_actor_critic_from_name(name_) elif type_ == "v": from genrl.deep.common.values import get_value_from_name return get_value_from_name(name_) elif type_ == "p": from genrl.deep.common.policies import get_policy_from_name return get_policy_from_name(name_) raise ValueError