class_docstr: Extends SGD in PyTorch with LARS scaling.
  
  See the paper `Large batch training of Convolutional Networks <https://arxiv.org/pdf/1708.03888.pdf>`_
  
  Args:
      params (iterable): iterable of parameters to optimize or dicts defining
          parameter groups
      lr (float): learning rate
      momentum (float, optional): momentum factor (default: 0)
      weight_decay (float, optional): weight decay (L2 penalty) (default: 0)
      dampening (float, optional): dampening for momentum (default: 0)
      nesterov (bool, optional): enables Nesterov momentum (default: False)
      trust_coefficient (float, optional): trust coefficient for computing LR (default: 0.001)
      eps (float, optional): eps for division denominator (default: 1e-8)
  
  Example:
      >>> from torch import nn
      >>> model = nn.Linear(10, 1)
      >>> optimizer = LARS(model.parameters(), lr=0.1, momentum=0.9)
      >>> 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.
code: def __setstate__(self, state):
      super().__setstate__(state)
  
      for group in self.param_groups:
          group.setdefault("nesterov", False)
  
file_path: lightning-flash/src/flash/core/optimizers/lars.py
imports: import torch
  from torch.optim.optimizer import Optimizer, required
  from flash.core.utilities.imports import _TOPIC_CORE_AVAILABLE
label_desc: Use image node_id 2 for calling the LARS obj's underlying member method code with example usage: obj.__setstate__(state) without return types