code: def test_learning_rate_decay_optimizer_constructor():
      # Test lr wd for ConvNeXT
      backbone = ToyConvNeXt()
      model = PseudoDataParallel(ToyDetector(backbone))
      optim_wrapper_cfg = dict(
          type="OptimWrapper",
          optimizer=dict(
              type="AdamW",
              lr=base_lr,
              betas=(0.9, 0.999),
              weight_decay=0.05,
          ),
      )
      # stagewise decay
      stagewise_paramwise_cfg = dict(
          decay_rate=decay_rate, decay_type="stage_wise", num_layers=6
      )
      optim_constructor = LearningRateDecayOptimizerConstructor(
          optim_wrapper_cfg, stagewise_paramwise_cfg
      )
      optim_wrapper = optim_constructor(model)
      check_optimizer_lr_wd(
          optim_wrapper.optimizer, expected_stage_wise_lr_wd_convnext
      )
      # layerwise decay
      layerwise_paramwise_cfg = dict(
          decay_rate=decay_rate, decay_type="layer_wise", num_layers=6
      )
      optim_constructor = LearningRateDecayOptimizerConstructor(
          optim_wrapper_cfg, layerwise_paramwise_cfg
      )
      optim_wrapper = optim_constructor(model)
      check_optimizer_lr_wd(
          optim_wrapper.optimizer, expected_layer_wise_lr_wd_convnext
      )
  
file_path: mmdetection/tests/test_engine/test_optimizers/test_layer_decay_optimizer_constructor.py
imports: import torch
  import torch.nn
  from mmcv.cnn import ConvModule
  from mmdet.engine import LearningRateDecayOptimizerConstructor
label_desc: Use image node_id 2 for calling a global function with example usage: test_learning_rate_decay_optimizer_constructor() without return types