code: def test_batchnorm_weight_decay(self):
      class MyModel(nn.Module):
          def __init__(self):
              super().__init__()
              self.lin = nn.Linear(2, 3)
              self.relu = nn.ReLU()
              self.bn = nn.BatchNorm1d(3)
  
          def forward(self, x):
              return self.bn(self.relu(self.lin(x)))
  
      torch.manual_seed(1)
      model = MyModel()
  
      opt = build_optimizer(self._get_config())
      bn_params, lin_params = split_batchnorm_params(model)
  
      lin_param_before = model.lin.weight.detach().clone()
      bn_param_before = model.bn.weight.detach().clone()
  
      with torch.enable_grad():
          x = torch.tensor([[1.0, 1.0], [1.0, 2.0]])
          out = model(x).pow(2).sum()
          out.backward()
  
      opt.set_param_groups(
          [
              {
                  "params": lin_params,
                  "lr": LinearParamScheduler(1, 2),
                  "weight_decay": 0.5,
              },
              {"params": bn_params, "lr": 0, "weight_decay": 0},
          ]
      )
  
      opt.step(where=0.5)
  
      # Make sure the linear parameters are trained but not the batch norm
      self.assertFalse(
          torch.allclose(model.lin.weight, lin_param_before)
      )
      self.assertTrue(torch.allclose(model.bn.weight, bn_param_before))
  
      opt.step(where=0.5)
  
      # Same, but after another step and triggering the lr scheduler
      self.assertFalse(
          torch.allclose(model.lin.weight, lin_param_before)
      )
      self.assertTrue(torch.allclose(model.bn.weight, bn_param_before))
  
imports: from abc import ABC, abstractmethod
  from unittest.mock import MagicMock
  import torch
  import torch.nn
  from classy_vision.generic.util import split_batchnorm_params
  from classy_vision.models import ClassyModel
  from classy_vision.optim import build_optimizer, build_optimizer_schedulers
  from classy_vision.optim.param_scheduler import LinearParamScheduler
label_desc: Use image node_id 15 for calling the TestOptimizer obj's underlying member method code with example usage: obj.test_batchnorm_weight_decay() and returns: self