class_docstr: Creates a LR scheduler with a learning rate that decreases as a
  polynomial decay from the initial LR set in the optimizer to end LR defined
  by `lr_end`, after a warmup period during which it increases linearly from
  :obj:`0` to 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.
      lr_end (float, optional): The end learning rate. (default: :obj:`1e-7`)
      power (float, optional): The power factor of the polynomial decay.
          (default: :obj:`1.0`)
      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","as","a","polynomial","decay","from","the","initial","LR","set","in","the","optimizer","to","end","LR","defined","by","`","lr_end","`",",","after","a","warmup","period","during","which","it","increases","linearly","from",":","obj",":","`","0","`","to","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",".","lr_end","(","float",",","optional",")",":","The","end","learning","rate",".","(","default",":",":","obj",":","`","1e-7","`",")","power","(","float",",","optional",")",":","The","power","factor","of","the","polynomial","decay",".","(","default",":",":","obj",":","`","1.0","`",")","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,
      lr_end: float = 1e-7,
      power: float = 1.0,
      last_epoch: int = -1,
  ):
      lr_init = optimizer.defaults["lr"]
      if not (lr_init > lr_end):
          raise ValueError(
              f"`lr_end` ({lr_end}) must be smaller than the "
              f"initial lr ({lr_init})"
          )
  
      lr_lambda = functools.partial(
          self._lr_lambda,
          num_warmup_steps=num_warmup_steps,
          num_training_steps=num_training_steps,
          lr_init=lr_init,
          lr_end=lr_end,
          power=power,
      )
      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 PolynomialWithWarmupLR object from inherited base classes: LambdaLR with example: obj = PolynomialWithWarmupLR(optimizer, num_warmup_steps, num_training_steps, lr_end, power, last_epoch)