class_docstr: Set the learning rate of each parameter group using a cosine annealing
  schedule, where :math:`\eta_{max}` is set to the initial lr and
  :math:`T_{cur}` is the number of epochs since the last restart in SGDR:
  
  .. math::
      \begin{aligned}
          \eta_t & = \eta_{min} + \frac{1}{2}(\eta_{max} - \eta_{min})\left(1
          + \cos\left(\frac{T_{cur}}{T_{max}}\pi\right)\right),
          & T_{cur} \neq (2k+1)T_{max}; \\
          \eta_{t+1} & = \eta_{t} + \frac{1}{2}(\eta_{max} - \eta_{min})
          \left(1 - \cos\left(\frac{1}{T_{max}}\pi\right)\right),
          & T_{cur} = (2k+1)T_{max}.
      \end{aligned}
  
  When last_epoch=-1, sets initial lr as lr. Notice that because the schedule
  is defined recursively, the learning rate can be simultaneously modified
  outside this scheduler by other operators. If the learning rate is set
  solely by this scheduler, the learning rate at each step becomes:
  
  .. math::
      \eta_t = \eta_{min} + \frac{1}{2}(\eta_{max} - \eta_{min})\left(1 +
      \cos\left(\frac{T_{cur}}{T_{max}}\pi\right)\right)
  
  It has been proposed in
  `SGDR: Stochastic Gradient Descent with Warm Restarts`_. Note that this only
  implements the cosine annealing part of SGDR, and not the restarts.
  
  .. _SGDR\: Stochastic Gradient Descent with Warm Restarts:
      https://arxiv.org/abs/1608.03983
  
  Args:
      optimizer (:class:`torch.optim.Optimizer`): Wrapped optimizer.
      total_steps (int): Number of total training steps.
      eta_min (int, optional): Minimum learning rate, defaults to 0.
      last_epoch (int, optional): The index of last epoch, defaults to -1. When last_epoch=-1,
          the schedule is started from the beginning or When last_epoch=-1, sets initial lr as lr.
code: def __init__(
      self,
      optimizer,
      total_steps: int,
      eta_min: int = 0,
      last_epoch: int = -1,
      **kwargs,
  ):
      super().__init__(
          optimizer, total_steps, eta_min=eta_min, last_epoch=last_epoch
      )
  
file_path: colossalai/colossalai/nn/lr_scheduler/cosine.py
imports: from torch.optim.lr_scheduler import CosineAnnealingLR
  from .delayed import DelayerScheduler, WarmupDelayerScheduler, WarmupScheduler
label_desc: Use image node_id 1 to create a new CosineAnnealingLR object from inherited base classes: _CosineAnnealingLR with example: obj = CosineAnnealingLR(optimizer, total_steps, eta_min, last_epoch)