code: def register_optimizer(name, bypass_checks=False):
      """Registers a ClassyOptimizer subclass.
  
      This decorator allows Classy Vision to instantiate a subclass of
      ClassyOptimizer from a configuration file, even if the class itself is not
      part of the Classy Vision framework. To use it, apply this decorator to a
      ClassyOptimizer subclass, like this:
  
      .. code-block:: python
  
          @register_optimizer('my_optimizer')
          class MyOptimizer(ClassyOptimizer):
              ...
  
      To instantiate an optimizer from a configuration file, see
      :func:`build_optimizer`."""
  
      def register_optimizer_cls(cls):
          if not bypass_checks:
              if name in OPTIMIZER_REGISTRY:
                  msg = "Cannot register duplicate optimizer ({}). Already registered at \n{}\n"
                  raise ValueError(
                      msg.format(name, OPTIMIZER_REGISTRY_TB[name])
                  )
              if not issubclass(cls, ClassyOptimizer):
                  raise ValueError(
                      "Optimizer ({}: {}) must extend ClassyVisionOptimizer".format(
                          name, cls.__name__
                      )
                  )
              if cls.__name__ in OPTIMIZER_CLASS_NAMES:
                  msg = (
                      "Cannot register optimizer with duplicate class name({})."
                      + "Previously registered at \n{}\n"
                  )
                  raise ValueError(
                      msg.format(
                          cls.__name__,
                          OPTIMIZER_CLASS_NAMES_TB[cls.__name__],
                      )
                  )
          tb = "".join(traceback.format_stack())
          OPTIMIZER_REGISTRY[name] = cls
          OPTIMIZER_CLASS_NAMES.add(cls.__name__)
          OPTIMIZER_REGISTRY_TB[name] = tb
          OPTIMIZER_CLASS_NAMES_TB[cls.__name__] = tb
          return cls
  
      return register_optimizer_cls
  
file_path: ClassyVision/classy_vision/optim/__init__.py
imports: import copy
  import traceback
  from pathlib import Path
  from classy_vision.generic.registry_utils import import_all_modules
  from .classy_optimizer import ClassyOptimizer
  from .param_scheduler import build_param_scheduler
  from .adam import Adam
  from .adamw import AdamW
  from .rmsprop import RMSProp
  from .rmsprop_tf import RMSPropTF
  from .sgd import SGD
  from .zero import ZeRO
label_desc: Use image node_id 3 for calling a global function with example usage: register_optimizer(name, bypass_checks) and returns: register_optimizer_cls, cls