code: def register_task(name):
      """Registers a ClassyTask subclass.
  
      This decorator allows Classy Vision to instantiate a subclass of ClassyTask
      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 ClassyTask
      subclass, like this:
  
      .. code-block:: python
  
          @register_task('my_task')
          class MyTask(ClassyTask):
              ...
  
      To instantiate a task from a configuration file, see :func:`build_task`.
      """
  
      def register_task_cls(cls):
          if name in TASK_REGISTRY:
              msg = "Cannot register duplicate task ({}). Already registered at \n{}\n"
              raise ValueError(msg.format(name, TASK_REGISTRY_TB[name]))
          if not issubclass(cls, ClassyTask):
              raise ValueError(
                  "Task ({}: {}) must extend ClassyTask".format(
                      name, cls.__name__
                  )
              )
          if cls.__name__ in TASK_CLASS_NAMES:
              msg = (
                  "Cannot register task with duplicate class name({})."
                  + "Previously registered at \n{}\n"
              )
              raise ValueError(
                  msg.format(
                      cls.__name__, TASK_CLASS_NAMES_TB[cls.__name__]
                  )
              )
          tb = "".join(traceback.format_stack())
          TASK_REGISTRY[name] = cls
          TASK_CLASS_NAMES.add(cls.__name__)
          TASK_REGISTRY_TB[name] = tb
          TASK_CLASS_NAMES_TB[cls.__name__] = tb
          return cls
  
      return register_task_cls
  
file_path: ClassyVision/classy_vision/tasks/__init__.py
imports: import traceback
  from pathlib import Path
  from classy_vision.generic.registry_utils import import_all_modules
  from .classy_task import ClassyTask
  from .classification_task import ClassificationTask
  from .fine_tuning_task import FineTuningTask
label_desc: Use image node_id 2 for calling a global function with example usage: register_task(name) and returns: register_task_cls, cls