dgs.models.optimizer.get_optimizer

dgs.models.optimizer.get_optimizer(instance: str | type) Type[torch.optim.Optimizer][source]

Given the name or an instance of an optimizer, return the respective instance.

Parameters:

instance – Either the name of the optimizer, which has to be in :data:OPTIMIZERS, or a subclass of :class:Optimizer.

Raises:

ValueError – If the instance has the wrong type.

Returns:

The class of the given optimizer.