class_docstr: Base class for all optimizers.
  
  .. warning::
      Parameters need to be specified as collections that have a deterministic
      ordering that is consistent between runs. Examples of objects that don't
      satisfy those properties are sets and iterators over values of dictionaries.
  
  Args:
      params (iterable): an iterable of :class:`torch.Tensor` s or
          :class:`dict` s. Specifies what Tensors should be optimized.
      defaults: (dict): a dict containing default values of optimization
          options (used when a parameter group doesn't specify them).
class_docstr_tok: ["Base","class","for","all","optimizers",".","..","warning",":",":","Parameters","need","to","be","specified","as","collections","that","have","a","deterministic","ordering","that","is","consistent","between","runs",".","Examples","of","objects","that","don't","satisfy","those","properties","are","sets","and","iterators","over","values","of","dictionaries",".","Args",":","params","(","iterable",")",":","an","iterable","of",":","class",":","`","torch.Tensor","`","s","or",":","class",":","`","dict","`","s.","Specifies","what","Tensors","should","be","optimized",".","defaults",":","(","dict",")",":","a","dict","containing","default","values","of","optimization","options","(","used","when","a","parameter","group","does","n't","specify","them",")","."]
docstr: Performs a single optimization step (parameter update).
  
  Args:
      closure (Callable): A closure that reevaluates the model and
          returns the loss. Optional for most optimizers.
  
  .. note::
      Unless otherwise specified, this function should not modify the
      ``.grad`` field of the parameters.
docstr_tok: ["Performs","a","single","optimization","step","(","parameter","update",")",".","Args",":","closure","(","Callable",")",":","A","closure","that","reevaluates","the","model","and","returns","the","loss",".","Optional","for","most","optimizers",".","..","note",":",":","Unless","otherwise","specified",",","this","function","should","not","modify","the","``",".grad","``","field","of","the","parameters","."]
code: def step(
      self, closure: Optional[Callable[[], float]] = None
  ) -> Optional[float]:
      r"""Performs a single optimization step (parameter update).
  
      Args:
          closure (Callable): A closure that reevaluates the model and
              returns the loss. Optional for most optimizers.
  
      .. note::
          Unless otherwise specified, this function should not modify the
          ``.grad`` field of the parameters.
      """
      raise NotImplementedError
  
imports: import math
  import functools
  import warnings
  from collections import OrderedDict, defaultdict
  from copy import deepcopy
  from itertools import chain
  from typing import Any, Callable, DefaultDict, Dict, Hashable, Iterable, List, Optional, Set, Tuple, TypeVar, Union, cast, overload
  from typing_extensions import ParamSpec, Self, TypeAlias
  import torch
  import torch.utils.hooks
  from torch.utils.hooks import RemovableHandle
  from torch.utils._foreach_utils import Indices, TensorListList, _get_foreach_kernels_supported_devices, _get_fused_kernels_supported_devices
  from torch._utils import is_compiling
  from torch.utils._foreach_utils import _group_tensors_by_device_and_dtype
label_desc: Use image node_id 22 for calling the Optimizer obj's underlying member method code with example usage: obj.step(closure) without return types