class_docstr: Base class for gradient clipping schedulers. We follow the same API
  as the standard PyTorch LR schedulers, but apply them to Opacus's
  `max_grad_norm` param instead.
  
  This means it only works when you pass a opacus.DPOptimizer, since that
  will have a `max_grad_norm` attribute.
class_docstr_tok: ["Base","class","for","gradient","clipping","schedulers",".","We","follow","the","same","API","as","the","standard","PyTorch","LR","schedulers",",","but","apply","them","to","Opacus's","`","max_grad_norm","`","param","instead",".","This","means","it","only","works","when","you","pass","a","opacus.DPOptimizer",",","since","that","will","have","a","`","max_grad_norm","`","attribute","."]
docstr: Args:
      optimizer (DPOptimizer): The DPOptimizer
      *: Any other positional args (this is an abstract base class)
      last_epoch(int): The index of last epoch. Default: -1.
docstr_tok: ["Args",":","optimizer","(","DPOptimizer",")",":","The","DPOptimizer","*",":","Any","other","positional","args","(","this","is","an","abstract","base","class",")","last_epoch","(","int",")",":","The","index","of","last","epoch",".","Default",":","-1","."]
code: def __init__(self, optimizer: DPOptimizer, *, last_epoch=-1):
      """
      Args:
          optimizer (DPOptimizer): The DPOptimizer
          *: Any other positional args (this is an abstract base class)
          last_epoch(int): The index of last epoch. Default: -1.
      """
      if not hasattr(optimizer, "max_grad_norm"):
          raise ValueError(
              "GradClipSchedulers require your optimizer to have a .max_grad_norm attr. "
              "Are you sure you are using a DPOptimizer? Those have it added for you."
          )
      self.optimizer = optimizer
      self.last_epoch = last_epoch
  
      self.step()
  
file_path: opacus/opacus/schedulers/grad_clip_scheduler.py
imports: from typing import Callable, Dict
  from opacus.optimizers import DPOptimizer
label_desc: Use image node_id 1 to create a new _GradClipScheduler object  with example: obj = _GradClipScheduler(optimizer)