code: def get_resnet_lr_decay_param_groups(
      model: nn.Module,
      model_config: AttrDict,
      optimizer_config: AttrDict,
      optimizer_schedulers: Dict[str, ParamScheduler],
  ):
      layer_decay = optimizer_config.layer_wise_lr_decay.decay
      num_layers = 4
      bn_regex = re.compile(r"\.bn[0-9]*\.")
  
      all_groups = LayerDecayGroupConstructor(
          layer_decay,
          num_layers,
          optimizer_schedulers,
          optimizer_config,
      )
      for name, param in model.named_parameters():
          if not param.requires_grad:
              continue
  
          # Regularize of biases or norm parameters
          with_regularisation = True
          if name.endswith(".bias"):
              with_regularisation = optimizer_config["regularize_bias"]
          elif bn_regex.search(name) is not None:
              with_regularisation = optimizer_config["regularize_bn"]
  
          # Get the target layer
          layer_depth = get_resnet_param_depth(name, num_layers)
  
          # Add the parameter group
          all_groups.append(
              layer_depth=layer_depth,
              with_regularisation=with_regularisation,
              optimizer_schedulers=optimizer_schedulers,
              param=param,
          )
  
      return all_groups.get()
  
file_path: vissl/vissl/optimizers/param_groups/layer_decay.py
imports: import re
  from typing import Dict
  import torch.nn
  from fvcore.common.param_scheduler import ParamScheduler
  from vissl.config import AttrDict
  from vissl.optimizers.param_groups.registry import register_param_group_constructor
  from vissl.optimizers.param_scheduler.layer_decay_scheduler import LayerDecayScheduler
  from vissl.utils.misc import is_apex_available
label_desc: Use image node_id 4 for calling a global function with example usage: get_resnet_lr_decay_param_groups(model, model_config, optimizer_config, optimizer_schedulers) and returns: all_groups