class_docstr: Linearly increase the lr from 0 to initial lr during warmup and decrease the lr to 0 after the warmup.
  
  Uses LambaLR scheduler where the learning rate is multiplied by a lambda factor after calling scheduler.step().
  
  Args:
  ----
      optimizer (Optimizer): Wrapped optimizer.
      num_train_steps (int): total number of training steps (number of batches * epochs).
      num_warmup_steps (int): number of training steps for learning rate warmup.
      last_epoch (int): The index of the last iteration. Default: -1. The scheduler
          will simply restart when resuming training from a checkpoint.
class_docstr_tok: ["Linearly","increase","the","lr","from","0","to","initial","lr","during","warmup","and","decrease","the","lr","to","0","after","the","warmup",".","Uses","LambaLR","scheduler","where","the","learning","rate","is","multiplied","by","a","lambda","factor","after","calling","scheduler.step","(",")",".","Args",":","--","--","optimizer","(","Optimizer",")",":","Wrapped","optimizer",".","num_train_steps","(","int",")",":","total","number","of","training","steps","(","number","of","batches","*","epochs",")",".","num_warmup_steps","(","int",")",":","number","of","training","steps","for","learning","rate","warmup",".","last_epoch","(","int",")",":","The","index","of","the","last","iteration",".","Default",":","-1",".","The","scheduler","will","simply","restart","when","resuming","training","from","a","checkpoint","."]
code: def __init__(
      self, optimizer, num_train_steps, num_warmup_steps, last_epoch=-1
  ) -> None:
      def linear_lr_lambda(current_step: int):
          lambda_during_warmup = float(current_step) / float(
              max(1, num_warmup_steps)
          )
          lambda_after_warmup = max(
              0.0,
              float(num_train_steps - current_step)
              / float(max(1, num_train_steps - num_warmup_steps)),
          )
          if current_step < num_warmup_steps:
              return lambda_during_warmup
          return lambda_after_warmup
  
      super().__init__(
          optimizer, lr_lambda=linear_lr_lambda, last_epoch=last_epoch
      )
  
imports: import logging
  import torch
  from torch.optim import Optimizer
  from torch.optim.lr_scheduler import LambdaLR, ReduceLROnPlateau, _LRScheduler
  from torch.optim.optimizer import required
label_desc: Use image node_id 1 to create a new LinearSchedulerWithWarmup object from inherited base classes: LambdaLR with example: obj = LinearSchedulerWithWarmup(optimizer, num_train_steps, num_warmup_steps, last_epoch)