Ejemplo n.º 1
0
 def _register_models_from_current_module_scope(module):
     for _name in dir(module):
         if _name.startswith("_"):
             continue
         _cls = getattr(module, _name)
         if isinstance(_cls, ModuleType):
             continue
         if ClassFactory.is_exists(ClassType.NETWORK,
                                   'torchvision_' + _cls.__name__):
             continue
         ClassFactory.register_cls(_cls,
                                   ClassType.NETWORK,
                                   alias='torchvision_' + _cls.__name__)
Ejemplo n.º 2
0
 def register(self, regclass, reg_path, reg_id):
     """Register a component class."""
     reg_id = self.get_reg_name(reg_id)
     ClassFactory.register_cls(regclass, type_name=get_reg_type(reg_path), alias=reg_id)
     self.logger.debug('registered: {}'.format(reg_id))