docstr: Performs a single optimization step.
  
  In automatic mode also updates SWA running averages.
docstr_tok: ["Performs","a","single","optimization","step",".","In","automatic","mode","also","updates","SWA","running","averages","."]
code: def step(self, closure=None, **kwargs):
      r"""Performs a single optimization step.
  
      In automatic mode also updates SWA running averages.
      """
      self._reset_lr_to_swa()
      loss = self.optimizer.step(closure)
      for group in self.param_groups:
          group["step_counter"] += 1
          steps = group["step_counter"]
          if self._auto_mode:
              if steps > self.swa_start and steps % self.swa_freq == 0:
                  self.update_swa_group(group)
      return loss
  
imports: import warnings
  from collections import defaultdict
  from typing import Optional, Union
  import torch
  from pytext.config.component import create_optimizer
  from pytext.optimizer.lamb import Lamb
  from pytext.optimizer.madgrad import MADGRAD
  from pytext.optimizer.optimizers import Adagrad, Adam, AdamW, Optimizer, SGD
  from pytext.optimizer.radam import RAdam
  from torch.optim import Optimizer
label_desc: Use image node_id 7 for calling the StochasticWeightAveraging obj's underlying member method code with example usage: obj.step(closure) and returns: loss