code: def register_collator(name):
      """
      Registers Self-Supervision data collators.
  
      This decorator allows VISSL to add custom data collators, even if the
      collator itself is not part of VISSL. To use it, apply this decorator
      to a collator function, like this:
  
      .. code-block:: python
  
          @register_collator('my_collator_name')
          def my_collator_name():
              ...
  
      To get a collator from a configuration file, see :func:`get_collator`.
      """
  
      def register_collator_fn(func):
          if name in COLLATOR_REGISTRY:
              raise ValueError(
                  "Cannot register duplicate collator ({})".format(name)
              )
  
          if func.__name__ in COLLATOR_NAMES:
              raise ValueError(
                  "Cannot register task with duplicate collator name ({})".format(
                      func.__name__
                  )
              )
          COLLATOR_REGISTRY[name] = func
          COLLATOR_NAMES.add(func.__name__)
          return func
  
      return register_collator_fn
  
imports: from functools import partial
  from pathlib import Path
  from classy_vision.generic.registry_utils import import_all_modules
  from torch.utils.data.dataloader import default_collate
label_desc: Use image node_id 1 for calling a global function with example usage: register_collator(name) and returns: register_collator_fn, func