noether.core.utils.model

Functions

copy_params(source_model, target_model)

Copy parameters and buffers from source_model to target_model.

compute_model_norm(module)

Norm of all weights of a module (useful for init sanity checks).

update_ema(source_model, target_model, target_factor)

Update the target model with an exponential moving average of the source model.

Module Contents

noether.core.utils.model.copy_params(source_model, target_model)

Copy parameters and buffers from source_model to target_model.

Parameters:
  • source_model (noether.core.models.ModelBase)

  • target_model (noether.core.models.ModelBase)

Return type:

None

noether.core.utils.model.compute_model_norm(module)

Norm of all weights of a module (useful for init sanity checks).

Parameters:

module (torch.nn.Module)

Return type:

torch.Tensor

noether.core.utils.model.update_ema(source_model, target_model, target_factor, copy_buffers=False)

Update the target model with an exponential moving average of the source model.

Parameters:
  • source_model (noether.core.models.ModelBase) – The source model to copy parameters from.

  • target_model (noether.core.models.ModelBase) – The target model to update.

  • target_factor (float) – The factor to use for the exponential moving average.

  • copy_buffers (bool) – Whether to copy buffers as well. Defaults to False.

Return type:

None