class_docstr: Implements AdaBelief algorithm. Modified from Adam in PyTorch
  
  Arguments:
      params (iterable): iterable of parameters to optimize or dicts defining
          parameter groups
      lr (float, optional): learning rate (default: 1e-3)
      betas (Tuple[float, float], optional): coefficients used for computing
          running averages of gradient and its square (default: (0.9, 0.999))
      eps (float, optional): term added to the denominator to improve
          numerical stability (default: 1e-16)
      weight_decay (float, optional): weight decay (L2 penalty) (default: 0)
      amsgrad (boolean, optional): whether to use the AMSGrad variant of this
          algorithm from the paper `On the Convergence of Adam and Beyond`_
          (default: False)
      decoupled_decay (boolean, optional): (default: True) If set as True, then
          the optimizer uses decoupled weight decay as in AdamW
      fixed_decay (boolean, optional): (default: False) 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).
      rectify (boolean, optional): (default: True) If set as True, then perform the rectified
          update similar to RAdam
      degenerated_to_sgd (boolean, optional) (default:True) If set as True, then perform SGD update
          when variance of gradient is high
  reference: AdaBelief Optimizer, adapting stepsizes by the belief in observed gradients, NeurIPS 2020
  
  For a complete table of recommended hyperparameters, see https://github.com/juntang-zhuang/Adabelief-Optimizer'
  For example train/args for EfficientNet see these gists
    - link to train_scipt: https://gist.github.com/juntang-zhuang/0a501dd51c02278d952cf159bc233037
    - link to args.yaml: https://gist.github.com/juntang-zhuang/517ce3c27022b908bb93f78e4f786dc3
code: def __init__(
      self,
      params,
      lr=1e-3,
      betas=(0.9, 0.999),
      eps=1e-16,
      weight_decay=0,
      amsgrad=False,
      decoupled_decay=True,
      fixed_decay=False,
      rectify=True,
      degenerated_to_sgd=True,
  ):
      if not 0.0 <= lr:
          raise ValueError("Invalid learning rate: {}".format(lr))
      if not 0.0 <= eps:
          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 (
          isinstance(params, (list, tuple))
          and len(params) > 0
          and isinstance(params[0], dict)
      ):
          for param in params:
              if "betas" in param and (
                  param["betas"][0] != betas[0]
                  or param["betas"][1] != betas[1]
              ):
                  param["buffer"] = [
                      [None, None, None] for _ in range(10)
                  ]
  
      defaults = dict(
          lr=lr,
          betas=betas,
          eps=eps,
          weight_decay=weight_decay,
          amsgrad=amsgrad,
          degenerated_to_sgd=degenerated_to_sgd,
          decoupled_decay=decoupled_decay,
          rectify=rectify,
          fixed_decay=fixed_decay,
          buffer=[[None, None, None] for _ in range(10)],
      )
      super(AdaBelief, self).__init__(params, defaults)
  
file_path: pytorch-image-models/timm/optim/adabelief.py
imports: import math
  import torch
  from torch.optim.optimizer import Optimizer
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, decoupled_decay, fixed_decay, rectify, degenerated_to_sgd)