dgs.utils.loader.get_instance¶
- dgs.utils.loader.get_instance(instance: str | type, instances: dict[str, Type[I]], inst_class: type) Type[I] [source]¶
- Parameters:
instance – Either the name of the instance, which has to be in
instances
, or a subclass of Optimizer.instances – A dictionary containing a mapping from instance names to instance classes.
inst_class – The class the instance should have.
- Raises:
ValueError – If the instance has the wrong type.
InvalidParameterException – If the instance is neither string nor of type
inst_class
.
- Returns:
The class-type of the given instance.