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",")","."]
code: def _cuda_graph_capture_health_check(self) -> None:
      # Note [torch.compile x capturable]
      # If we are compiling, we try to take the capturable path automatically by
      # setting the flag to True during tracing. Due to this, we skip all the checks
      # normally required for determining whether we can use CUDA graphs and
      # shunt the responsibility to torch.inductor. This saves time during tracing
      # since the checks are slow without sacrificing UX since inductor will warn
      # later if CUDA graphs cannot be enabled, e.g.,
      # https://github.com/pytorch/pytorch/blob/d3ba8901d8640eb16f88b2bfef9df7fa383d4b47/torch/_inductor/compile_fx.py#L390.
      # Thus, when compiling, inductor will determine if cudagraphs
      # can be enabled based on whether there is input mutation or CPU tensors.
      if (
          not is_compiling()
          and torch.backends.cuda.is_built()
          and torch.cuda.is_available()
      ):
          capturing = torch.cuda.is_current_stream_capturing()
  
          if capturing and not all(
              group["capturable"] for group in self.param_groups
          ):
              raise RuntimeError(
                  "Attempting CUDA graph capture of step() for an instance of "
                  + self.__class__.__name__
                  + " but param_groups' capturable is False."
              )
  
          if (
              (
                  not getattr(
                      self,
                      "_warned_capturable_if_run_uncaptured",
                      False,
                  )
              )
              and all(
                  group["capturable"] for group in self.param_groups
              )
              and (not capturing)
          ):
              warnings.warn(
                  "This instance was constructed with capturable=True or some of all the param_groups came with capturable=True, "
                  "but step() is running without CUDA graph capture. If you never intend to graph-capture this "
                  "instance, capturable=True can impair performance, and you should set capturable=False."
              )
              self._warned_capturable_if_run_uncaptured = True
  
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 5 for calling the Optimizer obj's underlying member method code with example usage: obj._cuda_graph_capture_health_check() without return types