code: def register_head(name, bypass_checks=False):
      """Registers a ClassyHead subclass.
  
      This decorator allows Classy Vision to instantiate a subclass of
      ClassyHead 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
      ClassyHead subclass, like this:
  
      .. code-block:: python
  
        @register_head("my_head")
        class MyHead(ClassyHead):
            ...
  
      To instantiate a head from a configuration file, see
      :func:`build_head`."""
  
      def register_head_cls(cls):
          if not bypass_checks:
              if name in HEAD_REGISTRY:
                  msg = "Cannot register duplicate head ({}). Already registered at \n{}\n"
                  raise ValueError(
                      msg.format(name, HEAD_REGISTRY_TB[name])
                  )
              if not issubclass(cls, ClassyHead):
                  raise ValueError(
                      "Head ({}: {}) must extend ClassyHead".format(
                          name, cls.__name__
                      )
                  )
              if cls.__name__ in HEAD_CLASS_NAMES:
                  msg = (
                      "Cannot register head with duplicate class name({})."
                      + "Previously registered at \n{}\n"
                  )
                  raise ValueError(
                      msg.format(
                          cls.__name__,
                          HEAD_CLASS_NAMES_TB[cls.__name__],
                      )
                  )
          tb = "".join(traceback.format_stack())
          HEAD_REGISTRY[name] = cls
          HEAD_CLASS_NAMES.add(cls.__name__)
          HEAD_REGISTRY_TB[name] = tb
          HEAD_CLASS_NAMES_TB[cls.__name__] = tb
          return cls
  
      return register_head_cls
  
file_path: ClassyVision/classy_vision/heads/__init__.py
imports: import copy
  import traceback
  from pathlib import Path
  from classy_vision.generic.registry_utils import import_all_modules
  from .classy_head import ClassyHead
  from .fully_connected_head import FullyConnectedHead
  from .fully_convolutional_linear_head import FullyConvolutionalLinearHead
  from .identity_head import IdentityHead
  from .vision_transformer_head import VisionTransformerHead
label_desc: Use image node_id 1 for calling a global function with example usage: register_head(name, bypass_checks) and returns: register_head_cls, cls