class_docstr: A registry to map strings to classes.
  
  Registered object could be built from registry.
  Example:
      >>> MODELS = Registry('models')
      >>> @MODELS.register_module()
      >>> class ResNet:
      >>>     pass
      >>> resnet = MODELS.build(dict(type='ResNet'))
  
  Please refer to
  https://mmcv.readthedocs.io/en/latest/understand_mmcv/registry.html for
  advanced usage.
  
  Args:
      name (str): Registry name.
      build_func(func, optional): Build function to construct instance from
          Registry, func:`build_from_cfg` is used if neither ``parent`` or
          ``build_func`` is specified. If ``parent`` is specified and
          ``build_func`` is not given,  ``build_func`` will be inherited
          from ``parent``. Default: None.
      parent (Registry, optional): Parent registry. The class registered in
          children registry could be built from parent. Default: None.
      scope (str, optional): The scope of registry. It is the key to search
          for children registry. If not specified, scope will be the name of
          the package where class is defined, e.g. mmdet, mmcls, mmseg.
          Default: None.
docstr: Register a module.
  
  A record will be added to `self._module_dict`, whose key is the class
  name or the specified name, and value is the class itself.
  It can be used as a decorator or a normal function.
  
  Example:
      >>> backbones = Registry('backbone')
      >>> @backbones.register_module()
      >>> class ResNet:
      >>>     pass
  
      >>> backbones = Registry('backbone')
      >>> @backbones.register_module(name='mnet')
      >>> class MobileNet:
      >>>     pass
  
      >>> backbones = Registry('backbone')
      >>> class ResNet:
      >>>     pass
      >>> backbones.register_module(ResNet)
  
  Args:
      name (str | None): The module name to be registered. If not
          specified, the class name will be used.
      force (bool, optional): Whether to override an existing class with
          the same name. Default: False.
      module (type): Module class to be registered.
docstr_tok: ["Register","a","module",".","A","record","will","be","added","to","`","self._module_dict","`",",","whose","key","is","the","class","name","or","the","specified","name",",","and","value","is","the","class","itself",".","It","can","be","used","as","a","decorator","or","a","normal","function",".","Example",":",">",">",">","backbones","=","Registry","(","'backbone","'",")",">",">",">","@","backbones.register_module","(",")",">",">",">","class","ResNet",":",">",">",">","pass",">",">",">","backbones","=","Registry","(","'backbone","'",")",">",">",">","@","backbones.register_module","(","name='mnet","'",")",">",">",">","class","MobileNet",":",">",">",">","pass",">",">",">","backbones","=","Registry","(","'backbone","'",")",">",">",">","class","ResNet",":",">",">",">","pass",">",">",">","backbones.register_module","(","ResNet",")","Args",":","name","(","str","|","None",")",":","The","module","name","to","be","registered",".","If","not","specified",",","the","class","name","will","be","used",".","force","(","bool",",","optional",")",":","Whether","to","override","an","existing","class","with","the","same","name",".","Default",":","False",".","module","(","type",")",":","Module","class","to","be","registered","."]
code: def register_module(self, name=None, force=False, module=None):
      """Register a module.
  
      A record will be added to `self._module_dict`, whose key is the class
      name or the specified name, and value is the class itself.
      It can be used as a decorator or a normal function.
  
      Example:
          >>> backbones = Registry('backbone')
          >>> @backbones.register_module()
          >>> class ResNet:
          >>>     pass
  
          >>> backbones = Registry('backbone')
          >>> @backbones.register_module(name='mnet')
          >>> class MobileNet:
          >>>     pass
  
          >>> backbones = Registry('backbone')
          >>> class ResNet:
          >>>     pass
          >>> backbones.register_module(ResNet)
  
      Args:
          name (str | None): The module name to be registered. If not
              specified, the class name will be used.
          force (bool, optional): Whether to override an existing class with
              the same name. Default: False.
          module (type): Module class to be registered.
      """
      if not isinstance(force, bool):
          raise TypeError(
              f"force must be a boolean, but got {type(force)}"
          )
      # NOTE: This is a walkaround to be compatible with the old api,
      # while it may introduce unexpected bugs.
      if isinstance(name, type):
          return self.deprecated_register_module(name, force=force)
  
      # raise the error ahead of time
      if not (
          name is None or isinstance(name, str) or is_seq_of(name, str)
      ):
          raise TypeError(
              "name must be either of None, an instance of str or a sequence"
              f"  of str, but got {type(name)}"
          )
  
      # use it as a normal method: x.register_module(module=SomeClass)
      if module is not None:
          self._register_module(
              module_class=module, module_name=name, force=force
          )
          return module
  
      # use it as a decorator: @x.register_module()
      def _register(cls):
          self._register_module(
              module_class=cls, module_name=name, force=force
          )
          return cls
  
      return _register
  
imports: import inspect
  import warnings
  from functools import partial
  from .misc import is_seq_of
label_desc: Use image node_id 16 for calling the Registry obj's underlying member method code with example usage: obj.register_module(name, force, module) and returns: _register, self, module, cls