class_docstr: Creates a LR scheduler with a learning rate that decreases following
  the values of the cosine function between the initial LR set in the
  optimizer to :obj:`0`, after a warmup period during which it increases
  linearly between :obj:`0` and the initial LR set in the optimizer.
  
  Args:
      optimizer (Optimizer): The optimizer to be scheduled.
      num_warmup_steps (int): The number of steps for the warmup phase.
      num_training_steps (int): The total number of training steps.
      num_cycles (float, optional): The number of waves in the cosine
          schedule (the default decreases LR from the max value to :obj:`0`
          following a half-cosine). (default: :obj:`0.5`)
      last_epoch (int, optional): The index of the last epoch when resuming
          training. (default: :obj:`-1`)
class_docstr_tok: ["Creates","a","LR","scheduler","with","a","learning","rate","that","decreases","following","the","values","of","the","cosine","function","between","the","initial","LR","set","in","the","optimizer","to",":","obj",":","`","0","`",",","after","a","warmup","period","during","which","it","increases","linearly","between",":","obj",":","`","0","`","and","the","initial","LR","set","in","the","optimizer",".","Args",":","optimizer","(","Optimizer",")",":","The","optimizer","to","be","scheduled",".","num_warmup_steps","(","int",")",":","The","number","of","steps","for","the","warmup","phase",".","num_training_steps","(","int",")",":","The","total","number","of","training","steps",".","num_cycles","(","float",",","optional",")",":","The","number","of","waves","in","the","cosine","schedule","(","the","default","decreases","LR","from","the","max","value","to",":","obj",":","`","0","`","following","a","half-cosine",")",".","(","default",":",":","obj",":","`","0.5","`",")","last_epoch","(","int",",","optional",")",":","The","index","of","the","last","epoch","when","resuming","training",".","(","default",":",":","obj",":","`","-1","`",")"]
code: def __init__(
      self,
      optimizer: Optimizer,
      num_warmup_steps: int,
      num_training_steps: int,
      num_cycles: float = 0.5,
      last_epoch: int = -1,
  ):
      lr_lambda = functools.partial(
          self._lr_lambda,
          num_warmup_steps=num_warmup_steps,
          num_training_steps=num_training_steps,
          num_cycles=num_cycles,
      )
      super().__init__(optimizer, lr_lambda, last_epoch)
  
imports: import functools
  import math
  from torch.optim import Optimizer
  from torch.optim.lr_scheduler import LambdaLR
label_desc: Use image node_id 1 to create a new CosineWithWarmupLR object from inherited base classes: LambdaLR with example: obj = CosineWithWarmupLR(optimizer, num_warmup_steps, num_training_steps, num_cycles, last_epoch)