vis4d.engine.optim.optimizer

Optimizer.

Functions

add_params(params, module, param_groups_cfg)

Add all parameters of module to the params list.

configure_optimizer(optim_cfg, model)

Configure optimizer with parameter groups.

set_up_optimizers(optimizers_cfg, models[, ...])

Set up optimizers.

Classes

ParamGroup

Parameter dictionary.

class ParamGroup[source]

Parameter dictionary.

params

List of parameters.

Type:

list[nn.Parameter]

lr

Learning rate.

Type:

NotRequired[float]

weight_decay

Weight decay.

Type:

NotRequired[float]

add_params(params, module, param_groups_cfg, prefix='')[source]

Add all parameters of module to the params list.

The parameters of the given module will be added to the list of param groups, with specific rules defined by paramwise_cfg.

Parameters:
  • params (list[DictStrAny]) – A list of param groups, it will be modified in place.

  • module (nn.Module) – The module to be added.

  • param_groups_cfg (dict[str, list[str] | float]) – The configuration of the param groups.

  • prefix (str) – The prefix of the module. Default: ‘’.

Return type:

None

configure_optimizer(optim_cfg, model)[source]

Configure optimizer with parameter groups.

Return type:

Optimizer

set_up_optimizers(optimizers_cfg, models, steps_per_epoch=-1)[source]

Set up optimizers.

Return type:

tuple[list[Optimizer], list[LRSchedulerWrapper]]