class_docstr: Implements AdaBelief Optimizer Algorithm.
  It has been proposed in `AdaBelief Optimizer, adapting stepsizes by
  the belief in observed gradients`__.
  
  Arguments:
      params: iterable of parameters to optimize or dicts defining
          parameter groups
      lr: learning rate (default: 1e-2)
      betas: coefficients used for computing
          running averages of gradient and its square (default: (0.9, 0.999))
      eps: term added to the denominator to improve
          numerical stability (default: 0.001)
      weight_decay: weight decay (L2 penalty) (default: 0)
      amsgrad: whether to use the AMSGrad variant of this
          algorithm from the paper `On the Convergence of Adam and Beyond`_
          (default: False)
      weight_decouple:  If set as True, then the optimizer uses decoupled
          weight decay as in AdamW (default: False)
      fixed_decay : This is used when
          weight_decouple is set as True.
          When fixed_decay == True, the weight decay is performed as
          $W_{new} = W_{old} - W_{old} \times decay$.
          When fixed_decay == False, the weight decay is performed as
          $W_{new} = W_{old} - W_{old} \times decay \times lr$. Note that in
          this case, the weight decay ratio decreases with learning
          rate (lr).  (default: False)
      rectify: (default: False) If set as True, then perform the rectified
          update similar to RAdam
  
  __ https://arxiv.org/abs/2010.07468
  
  Note:
      Reference code: https://github.com/juntang-zhuang/Adabelief-Optimizer
code: def __init__(
      self,
      params: Params,
      lr: float = 1e-3,
      betas: Betas2 = (0.9, 0.999),
      eps: float = 1e-8,
      weight_decay: float = 0,
      amsgrad: bool = False,
      weight_decouple: bool = False,
      fixed_decay: bool = False,
      rectify: bool = False,
  ) -> None:
      if lr <= 0.0:
          raise ValueError("Invalid learning rate: {}".format(lr))
      if eps < 0.0:
          raise ValueError("Invalid epsilon value: {}".format(eps))
      if not 0.0 <= betas[0] < 1.0:
          raise ValueError(
              "Invalid beta parameter at index 0: {}".format(betas[0])
          )
      if not 0.0 <= betas[1] < 1.0:
          raise ValueError(
              "Invalid beta parameter at index 1: {}".format(betas[1])
          )
      if weight_decay < 0:
          raise ValueError(
              "Invalid weight_decay value: {}".format(weight_decay)
          )
      defaults = dict(
          lr=lr,
          betas=betas,
          eps=eps,
          weight_decay=weight_decay,
          amsgrad=amsgrad,
      )
      super(AdaBelief, self).__init__(params, defaults)
  
      self._weight_decouple = weight_decouple
      self._rectify = rectify
      self._fixed_decay = fixed_decay
  
file_path: pywick/pywick/optimizers/adabelief.py
imports: import math
  import torch
  from torch.optim.optimizer import Optimizer
  from .a2grad import Betas2, OptFloat, OptLossClosure, Params
label_desc: Use image node_id 1 to create a new AdaBelief object from inherited base classes: Optimizer with example: obj = AdaBelief(params, lr, betas, eps, weight_decay, amsgrad, weight_decouple, fixed_decay, rectify)