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 _lr_lambda(
      current_step: int,
      num_warmup_steps: int,
      num_training_steps: int,
      lr_init: float,
      lr_end: float,
      power: float,
  ) -> float:
      if current_step < num_warmup_steps:
          return float(current_step) / float(max(1, num_warmup_steps))
      elif current_step > num_training_steps:
          return (
              lr_end / lr_init
          )  # As `LambdaLR` multiplies by `lr_init`.
      else:
          lr_range = lr_init - lr_end
          decay_steps = num_training_steps - num_warmup_steps
          pct_remaining = (
              1 - (current_step - num_warmup_steps) / decay_steps
          )
          decay = lr_range * pct_remaining**power + lr_end
          return decay / lr_init
  
imports: import functools
  import math
  from torch.optim import Optimizer
  from torch.optim.lr_scheduler import LambdaLR
label_desc: Use image node_id 2 for calling the PolynomialWithWarmupLR obj's underlying member method code with example usage: obj._lr_lambda(current_step, num_warmup_steps, num_training_steps, lr_init, lr_end, power) and returns: unknown, unknown, unknown