code: def test_lr_schedule(self):
      config = self._get_config()
  
      opt = build_optimizer(config)
      param_schedulers = build_optimizer_schedulers(config)
      opt.set_param_groups(
          {"params": self._parameters(), **param_schedulers}
      )
  
      # Test initial learning rate
      for group in opt.optimizer.param_groups:
          self.assertEqual(group["lr"], 0.1)
  
      def _test_lr_schedule(optimizer, num_epochs, epochs, targets):
          for i in range(len(epochs)):
              epoch = epochs[i]
              target = targets[i]
              param_groups = optimizer.optimizer.param_groups.copy()
              optimizer.on_epoch(epoch / num_epochs)
              for idx, group in enumerate(
                  optimizer.optimizer.param_groups
              ):
                  self.assertEqual(group["lr"], target)
                  # Make sure all but LR is same
                  param_groups[idx]["lr"] = target
                  self.assertEqual(param_groups[idx], group)
  
      # Test constant learning schedule
      num_epochs = 90
      epochs = [
          0,
          0.025,
          0.05,
          0.1,
          0.5,
          1,
          15,
          29,
          30,
          31,
          59,
          60,
          61,
          88,
          89,
      ]
      targets = [0.1] * 15
      _test_lr_schedule(opt, num_epochs, epochs, targets)
  
      # Test step learning schedule
      config["param_schedulers"] = {
          "lr": {"name": "step", "values": [0.1, 0.01, 0.001]}
      }
      opt = build_optimizer(config)
      param_schedulers = build_optimizer_schedulers(config)
      opt.set_param_groups(
          {"params": self._parameters(), **param_schedulers}
      )
  
      targets = [0.1] * 8 + [0.01] * 3 + [0.001] * 4
      _test_lr_schedule(opt, num_epochs, epochs, targets)
  
      # Test step learning schedule with warmup
      init_lr = 0.01
      warmup_epochs = 0.1
      config["param_schedulers"] = {
          "lr": {
              "name": "composite",
              "schedulers": [
                  {
                      "name": "linear",
                      "start_value": init_lr,
                      "end_value": 0.1,
                  },
                  {"name": "step", "values": [0.1, 0.01, 0.001]},
              ],
              "update_interval": "epoch",
              "interval_scaling": ["rescaled", "fixed"],
              "lengths": [
                  warmup_epochs / num_epochs,
                  1 - warmup_epochs / num_epochs,
              ],
          }
      }
  
      opt = build_optimizer(config)
      param_schedulers = build_optimizer_schedulers(config)
      opt.set_param_groups(
          {"params": self._parameters(), **param_schedulers}
      )
  
      targets = (
          [0.01, 0.0325, 0.055] + [0.1] * 5 + [0.01] * 3 + [0.001] * 4
      )
      _test_lr_schedule(opt, num_epochs, epochs, targets)
  
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 11 for calling the TestOptimizer obj's underlying member method code with example usage: obj.test_lr_schedule() without return types