class_docstr: Represents the learning rate schedule described in
  :cite:t:`https://doi.org/10.48550/arxiv.1608.03983`.
  
  **During warmup:**
  
  .. math::
      \eta_t = \eta_{base} \frac{t}{T_{warmup}}
  
  **After warmup:**
  
  .. math::
      \eta_t = \eta_{final}^i + \frac{1}{2} (\eta_{base}^i - \eta_{final}^i) (1 + \text{cos}(\pi \frac{t_{i}}{T_{i}}))
  
  where :math:`i` is the number of the current annealing cycle, :math:`t_i` is
  the number of steps taken since the last restart, and :math:`T_i` is the
  total number of steps within the :math:`i`-th cycle (i.e. *length* of the
  cycle).
  
  *Cosine Annealing* is a type of learning rate schedule that has the effect
  of starting with a large learning rate that is relatively rapidly decreased
  to a minimum value before being increased rapidly again.
  
  Please refer to the paper to learn more about the details.
  
  In addition to the original schedule, this implementation also supports a
  warmup phase where the learning rate is linearly increased for the first
  :math:`T_{warmup}` training steps to the base learning rate.
  
  .. note::
      This scheduler is not chainable.
class_docstr_tok: ["Represents","the","learning","rate","schedule","described","in",":","cite",":","t",":","`","https",":","\/\/doi.org\/10.48550\/arxiv.1608.03983","`",".","*","*","During","warmup",":","*","*","..","math",":",":","\\eta_t","=","\\eta_","{","base","}","\\frac","{","t","}","{","T_","{","warmup","}","}","*","*","After","warmup",":","*","*","..","math",":",":","\\eta_t","=","\\eta_","{","final","}","^i","+","\\frac","{","1","}","{","2","}","(","\\eta_","{","base","}","^i","-","\\eta_","{","final","}","^i",")","(","1","+","\\text","{","cos","}","(","\\pi","\\frac","{","t_","{","i","}","}","{","T_","{","i","}","}",")",")","where",":","math",":","`","i","`","is","the","number","of","the","current","annealing","cycle",",",":","math",":","`","t_i","`","is","the","number","of","steps","taken","since","the","last","restart",",","and",":","math",":","`","T_i","`","is","the","total","number","of","steps","within","the",":","math",":","`","i","`","-th","cycle","(","i.e",".","*","length","*","of","the","cycle",")",".","*","Cosine","Annealing","*","is","a","type","of","learning","rate","schedule","that","has","the","effect","of","starting","with","a","large","learning","rate","that","is","relatively","rapidly","decreased","to","a","minimum","value","before","being","increased","rapidly","again",".","Please","refer","to","the","paper","to","learn","more","about","the","details",".","In","addition","to","the","original","schedule",",","this","implementation","also","supports","a","warmup","phase","where","the","learning","rate","is","linearly","increased","for","the","first",":","math",":","`","T_","{","warmup","}","`","training","steps","to","the","base","learning","rate",".","..","note",":",":","This","scheduler","is","not","chainable","."]
code: def _compute_lrs(self) -> List[float]:
      # Linearly increase the learning rate to its base value during warmup.
      if self.last_epoch <= self.num_warmup_steps:
          c = self.last_epoch / self.num_warmup_steps
  
          return [
              i + (b - i) * c
              for b, i in zip(self.base_lrs, self.start_lrs)
          ]
  
      curr_step = self.last_epoch - self.num_warmup_steps
  
      # When each cycle has equal length, the computation is straightforward.
      if self.cycle_mul == 1.0:
          cycle_num = curr_step // self.cycle_len
  
          cycle_len = self.cycle_len
  
          # The position of the step within the cycle.
          cycle_pos = curr_step - (cycle_num * cycle_len)
  
      # Otherwise, it becomes a bit trickier. We have to treat the cycles as
      # a geometric series to find out the number, length, and offset of the
      # current cycle.
      else:
          mul = self.cycle_mul
  
          # Solve the equation \sum_{i=0}^{n} len(cycle_i) + x = step for n.
          cycle_num = int(
              math.log(1 - curr_step / self.cycle_len * (1 - mul), mul)
          )
  
          cycle_len = int(mul**cycle_num * self.cycle_len)
  
          # Compute the sum of the lengths of the first `cycle_num` cycles
          # (i.e. geometric series) which corresponds to the beginning offset
          # of the current cycle.
          cycle_offset = int(
              (1 - mul**cycle_num) / (1 - mul) * self.cycle_len
          )
  
          # The position of the step within the cycle.
          cycle_pos = curr_step - cycle_offset
  
      lr_mul = self.lr_mul**cycle_num
  
      c = math.cos(math.pi * cycle_pos / cycle_len)
  
      min_lrs, max_lrs = self.final_lrs, self.base_lrs
  
      return [
          self._cycle_lr(mn, mx, lr_mul, c)
          for mn, mx in zip(min_lrs, max_lrs)
      ]
  
imports: import math
  import warnings
  from abc import ABC, abstractmethod
  from typing import List, Sequence, Union, final
  from torch.optim import Optimizer
  from torch.optim.lr_scheduler import _LRScheduler
  from typing_extensions import TypeAlias
  from fairseq2.typing import finaloverride
label_desc: Use image node_id 2 for calling the CosineAnnealingLR obj's underlying member method code with example usage: obj._compute_lrs() and returns: unknown, unknown