def register_network_cls(t_cls): if t_cls.__name__ in cls.__network_registry__[net_type]: raise ValueError( "Cannot register duplicate network ({})".format( t_cls.__name__)) # TODO: Unified networkFactory and classFactory if net_type == NetTypes.LOSS: ClassFactory.register_cls(t_cls, ClassType.LOSS) cls.__network_registry__[net_type][t_cls.__name__] = t_cls return t_cls
def import_torch_operators(): """Import search space operators from torch.""" ops = Config() for _name in dir(nn): if _name.startswith("_"): continue _cls = getattr(nn, _name) if not isclass(_cls): continue ops[_name] = ClassFactory.register_cls(_cls, ClassType.SEARCH_SPACE) return ops