class_docstr: Extends SGD in PyTorch with LARS scaling from the paper
  `Large batch training of Convolutional Networks`__.
  
  Arguments:
      params (iterable): iterable of parameters to optimize or dicts defining
          parameter groups
      lr: learning rate (default: 1e-3)
      momentum: momentum factor (default: 0)
      dampening: dampening for momentum (default: 0)
      eps: term added to the denominator to improve
          numerical stability (default: 1e-8)
      weight_decay: weight decay (L2 penalty) (default: 0)
      nesterov: enables Nesterov momentum (default: False)
      trust_coefficient: trust coefficient for computing LR (default: 0.001)
      eps: eps for division denominator (default: 1e-8)
  
  Example:
      >>> import torch_optimizer as optim
      >>> optimizer = optim.LARS(model.parameters(), lr=0.001)
      >>> optimizer.zero_grad()
      >>> loss_fn(model(input), target).backward()
      >>> optimizer.step()
  
  .. note::
      The application of momentum in the SGD part is modified according to
      the PyTorch standards. LARS scaling fits into the equation in the
      following fashion.
  
      .. math::
          \begin{aligned}
              g_{t+1} & = \text{lars_lr} * (\beta * p_{t} + g_{t+1}), \\
              v_{t+1} & = \\mu * v_{t} + g_{t+1}, \\
              p_{t+1} & = p_{t} - \text{lr} * v_{t+1},
          \\end{aligned}
  
      where :math:`p`, :math:`g`, :math:`v`, :math:`\\mu` and :math:`\beta`
      denote the parameters, gradient, velocity, momentum, and weight decay
      respectively.  The :math:`lars_lr` is defined by Eq. 6 in the paper.
      The Nesterov version is analogously modified.
  
  .. warning::
      Parameters with weight decay set to 0 will automatically be excluded
      from layer-wise LR scaling. This is to ensure consistency with papers
      like SimCLR and BYOL.
  
  
  __ https://arxiv.org/pdf/1708.03888.pdf
  
  Note:
      Reference code: https://github.com/PyTorchLightning/lightning-bolts/
code: def __init__(
      self,
      params: Params,
      lr: float = 1e-2,
      momentum: float = 0.0,
      dampening: float = 0.0,
      weight_decay: float = 0.0,
      nesterov: bool = False,
      trust_coefficient: float = 0.01,
      eps: float = 1e-8,
  ):
      if lr <= 0.0:
          raise ValueError("Invalid learning rate: {}".format(lr))
      if eps < 0.0:
          raise ValueError("Invalid epsilon value: {}".format(eps))
      if momentum < 0.0:
          raise ValueError(
              "Invalid momentum value: {}".format(momentum)
          )
      if dampening < 0.0:
          raise ValueError(
              "Invalid dampening value: {}".format(dampening)
          )
      if weight_decay < 0.0:
          raise ValueError(
              "Invalid weight_decay value: {}".format(weight_decay)
          )
      if trust_coefficient < 0.0:
          raise ValueError(
              "Invalid trust_coefficient value: {}".format(
                  trust_coefficient
              )
          )
  
      defaults = dict(
          lr=lr,
          momentum=momentum,
          dampening=dampening,
          weight_decay=weight_decay,
          nesterov=nesterov,
          trust_coefficient=trust_coefficient,
          eps=eps,
      )
      if nesterov and (momentum <= 0 or dampening != 0):
          raise ValueError(
              "Nesterov momentum requires a momentum and zero dampening"
          )
  
      super().__init__(params, defaults)
  
imports: import torch
  from torch.optim.optimizer import Optimizer
  from .types import OptFloat, OptLossClosure, Params, State
label_desc: Use image node_id 1 to create a new LARS object from inherited base classes: Optimizer with example: obj = LARS(params, lr, momentum, dampening, weight_decay, nesterov, trust_coefficient, eps)