def obtain_search_model(config):
    if (config.dataset == 'cifar'):
        if (config.arch == 'resnet'):
            from .shape_searchs import SearchWidthCifarResNet
            from .shape_searchs import SearchDepthCifarResNet
            from .shape_searchs import SearchShapeCifarResNet
            if (config.search_mode == 'width'):
                return SearchWidthCifarResNet(config.module, config.depth, config.class_num)
            elif (config.search_mode == 'depth'):
                return SearchDepthCifarResNet(config.module, config.depth, config.class_num)
            elif (config.search_mode == 'shape'):
                return SearchShapeCifarResNet(config.module, config.depth, config.class_num)
            else:
                raise ValueError('invalid search mode : {:}'.format(config.search_mode))
        elif (config.arch == 'simres'):
            from .shape_searchs import SearchWidthSimResNet
            if (config.search_mode == 'width'):
                return SearchWidthSimResNet(config.depth, config.class_num)
            else:
                raise ValueError('invalid search mode : {:}'.format(config.search_mode))
        else:
            raise ValueError('invalid arch : {:} for dataset [{:}]'.format(config.arch, config.dataset))
    elif (config.dataset == 'imagenet'):
        from .shape_searchs import SearchShapeImagenetResNet
        assert (config.search_mode == 'shape'), 'invalid search-mode : {:}'.format(config.search_mode)
        if (config.arch == 'resnet'):
            return SearchShapeImagenetResNet(config.block_name, config.layers, config.deep_stem, config.class_num)
        else:
            raise ValueError('invalid model config : {:}'.format(config))
    else:
        raise ValueError('invalid dataset in the model config : {:}'.format(config))
def obtain_search_model(config):
    if (config.dataset == 'cifar'):
        if (config.arch == 'resnet'):
            from .shape_searchs import SearchWidthCifarResNet
            from .shape_searchs import SearchDepthCifarResNet
            from .shape_searchs import SearchShapeCifarResNet
            if (config.search_mode == 'width'):
                return SearchWidthCifarResNet(config.module, config.depth, config.class_num)
            elif (config.search_mode == 'depth'):
                return SearchDepthCifarResNet(config.module, config.depth, config.class_num)
            elif (config.search_mode == 'shape'):
                return SearchShapeCifarResNet(config.module, config.depth, config.class_num)
            else:
                raise ValueError('invalid search mode : {:}'.format(config.search_mode))
        elif (config.arch == 'simres'):
            from .shape_searchs import SearchWidthSimResNet
            if (config.search_mode == 'width'):
                return SearchWidthSimResNet(config.depth, config.class_num)
            else:
                raise ValueError('invalid search mode : {:}'.format(config.search_mode))
        else:
            raise ValueError('invalid arch : {:} for dataset [{:}]'.format(config.arch, config.dataset))
    elif (config.dataset == 'imagenet'):
        from .shape_searchs import SearchShapeImagenetResNet
        assert (config.search_mode == 'shape'), 'invalid search-mode : {:}'.format(config.search_mode)
        if (config.arch == 'resnet'):
            return SearchShapeImagenetResNet(config.block_name, config.layers, config.deep_stem, config.class_num)
        else:
            raise ValueError('invalid model config : {:}'.format(config))
    else:
        raise ValueError('invalid dataset in the model config : {:}'.format(config))