def get_cell_based_tiny_net(config):
    if isinstance(config, dict):
        config = dict2config(config, None)
    super_type = getattr(config, 'super_type', 'basic')
    group_names = ['DARTS-V1', 'DARTS-V2', 'GDAS', 'SETN', 'ENAS', 'RANDOM', 'generic']
    if ((super_type == 'basic') and (config.name in group_names)):
        from .cell_searchs import nas201_super_nets as nas_super_nets
        try:
            return nas_super_nets[config.name](config.C, config.N, config.max_nodes, config.num_classes, config.space, config.affine, config.track_running_stats)
        except:
            return nas_super_nets[config.name](config.C, config.N, config.max_nodes, config.num_classes, config.space)
    elif (super_type == 'search-shape'):
        from .shape_searchs import GenericNAS301Model
        genotype = CellStructure.str2structure(config.genotype)
        return GenericNAS301Model(config.candidate_Cs, config.max_num_Cs, genotype, config.num_classes, config.affine, config.track_running_stats)
    elif (super_type == 'nasnet-super'):
        from .cell_searchs import nasnet_super_nets as nas_super_nets
        return nas_super_nets[config.name](config.C, config.N, config.steps, config.multiplier, config.stem_multiplier, config.num_classes, config.space, config.affine, config.track_running_stats)
    elif (config.name == 'infer.tiny'):
        from .cell_infers import TinyNetwork
        if hasattr(config, 'genotype'):
            genotype = config.genotype
        elif hasattr(config, 'arch_str'):
            genotype = CellStructure.str2structure(config.arch_str)
        else:
            raise ValueError('Can not find genotype from this config : {:}'.format(config))
        return TinyNetwork(config.C, config.N, genotype, config.num_classes)
    elif (config.name == 'infer.shape.tiny'):
        from .shape_infers import DynamicShapeTinyNet
        if isinstance(config.channels, str):
            channels = tuple([int(x) for x in config.channels.split(':')])
        else:
            channels = config.channels
        genotype = CellStructure.str2structure(config.genotype)
        return DynamicShapeTinyNet(channels, genotype, config.num_classes)
    elif (config.name == 'infer.nasnet-cifar'):
        from .cell_infers import NASNetonCIFAR
        raise NotImplementedError
    else:
        raise ValueError('invalid network name : {:}'.format(config.name))
def get_cell_based_tiny_net(config):
    if isinstance(config, dict):
        config = dict2config(config, None)
    super_type = getattr(config, 'super_type', 'basic')
    group_names = ['DARTS-V1', 'DARTS-V2', 'GDAS', 'SETN', 'ENAS', 'RANDOM', 'generic']
    if ((super_type == 'basic') and (config.name in group_names)):
        from .cell_searchs import nas201_super_nets as nas_super_nets
        try:
            return nas_super_nets[config.name](config.C, config.N, config.max_nodes, config.num_classes, config.space, config.affine, config.track_running_stats)
        except:
            return nas_super_nets[config.name](config.C, config.N, config.max_nodes, config.num_classes, config.space)
    elif (super_type == 'search-shape'):
        from .shape_searchs import GenericNAS301Model
        genotype = CellStructure.str2structure(config.genotype)
        return GenericNAS301Model(config.candidate_Cs, config.max_num_Cs, genotype, config.num_classes, config.affine, config.track_running_stats)
    elif (super_type == 'nasnet-super'):
        from .cell_searchs import nasnet_super_nets as nas_super_nets
        return nas_super_nets[config.name](config.C, config.N, config.steps, config.multiplier, config.stem_multiplier, config.num_classes, config.space, config.affine, config.track_running_stats)
    elif (config.name == 'infer.tiny'):
        from .cell_infers import TinyNetwork
        if hasattr(config, 'genotype'):
            genotype = config.genotype
        elif hasattr(config, 'arch_str'):
            genotype = CellStructure.str2structure(config.arch_str)
        else:
            raise ValueError('Can not find genotype from this config : {:}'.format(config))
        return TinyNetwork(config.C, config.N, genotype, config.num_classes)
    elif (config.name == 'infer.shape.tiny'):
        from .shape_infers import DynamicShapeTinyNet
        if isinstance(config.channels, str):
            channels = tuple([int(x) for x in config.channels.split(':')])
        else:
            channels = config.channels
        genotype = CellStructure.str2structure(config.genotype)
        return DynamicShapeTinyNet(channels, genotype, config.num_classes)
    elif (config.name == 'infer.nasnet-cifar'):
        from .cell_infers import NASNetonCIFAR
        raise NotImplementedError
    else:
        raise ValueError('invalid network name : {:}'.format(config.name))