def sample_cfgs()

in tools/sweep_setup.py [0:0]


def sample_cfgs(seed):
    """Samples chunk configs and return those that are unique and valid."""
    # Fix RNG seed (every call to this function should use a unique seed)
    np.random.seed(seed)
    setup_cfg = sweep_cfg.SETUP
    cfgs = {}
    for _ in range(setup_cfg.CHUNK_SIZE):
        # Sample parameters [key, val, ...] list based on the samplers
        params = samplers.sample_parameters(setup_cfg.SAMPLERS)
        # Check if config is unique, if not continue
        key = zip(params[0::2], params[1::2])
        key = " ".join(["{} {}".format(k, v) for k, v in key])
        if key in cfgs:
            continue
        # Generate config from parameters
        reset_cfg()
        cfg.merge_from_other_cfg(setup_cfg.BASE_CFG)
        cfg.merge_from_list(params)
        # Check if config is valid, if not continue
        is_valid = samplers.check_regnet_constraints(setup_cfg.CONSTRAINTS)
        if not is_valid:
            continue
        # Special logic for dealing w model scaling (side effect is to standardize cfg)
        if cfg.MODEL.TYPE in ["anynet", "effnet", "regnet"]:
            scaler.scale_model()
        # Check if config is valid, if not continue
        is_valid = samplers.check_complexity_constraints(setup_cfg.CONSTRAINTS)
        if not is_valid:
            continue
        # Set config description to key
        cfg.DESC = key
        # Store copy of config if unique and valid
        cfgs[key] = cfg.clone()
        # Stop sampling if already reached quota
        if len(cfgs) == setup_cfg.NUM_CONFIGS:
            break
    return cfgs