dgs.models.optimizer.register_optimizer¶
- dgs.models.optimizer.register_optimizer(name: str, new_optimizer: Type[torch.optim.Optimizer]) None [source]¶
Register a new optimizer to be used with custom configs.
- Parameters:
name – Name of the new optimizer, e.g. “CustomAdam”. The name cannot be a value already present in :data:
OPTIMIZERS
.new_optimizer – The type / class of the optimizer to register.
- Raises:
ValueError – If
optim_name
is in :data:OPTIMIZERS.keys()
or the instance is invalid.
Examples:
from torch import optim class CustomAdam(optim.Optimizer): ... register_optimizer("CustomAdam", CustomAdam)