class_docstr: An OptimizerInput that will cause the optimizer to throw an error when constructed.
  Includes the type and string of the resulting error.
class_docstr_tok: ["An","OptimizerInput","that","will","cause","the","optimizer","to","throw","an","error","when","constructed",".","Includes","the","type","and","string","of","the","resulting","error","."]
code: def __init__(
      self,
      optimizer_error_input,
      *,
      error_on=OptimizerErrorEnum.CONSTRUCTION_ERROR,
      error_type=RuntimeError,
      error_regex="",
  ):
      self.optimizer_error_input = optimizer_error_input
      self.error_on = error_on
      self.error_type = error_type
      self.error_regex = error_regex
  
imports: import functools
  import itertools
  import math
  import unittest
  from copy import deepcopy
  from enum import Enum
  from typing import Any, Dict, List, Tuple, Union
  import torch
  from torch import Tensor
  from torch.nn import Parameter
  from torch.optim import Adadelta, Adagrad, Adam, Adamax, AdamW, ASGD, LBFGS, NAdam, Optimizer, RAdam, RMSprop, Rprop, SGD, SparseAdam
  from torch.testing._internal.common_device_type import tol, toleranceOverride
  from torch.testing._internal.common_methods_invocations import DecorateInfo
  from torch.testing._internal.common_utils import _TestParametrizer, set_single_threaded_if_parallel_tbb, skipIfMps, skipIfTorchDynamo, TEST_WITH_TORCHDYNAMO
  from torch.utils._foreach_utils import _get_foreach_kernels_supported_devices, _get_fused_kernels_supported_devices
label_desc: Use image node_id 1 to create a new ErrorOptimizerInput object  with example: obj = ErrorOptimizerInput(optimizer_error_input)