| 10436 | 'subset_quantization_differs'), |
| 10437 | argvalues=list(LOAD_AND_QUANTIZE_TEST_PARAMS.values()), ids=list(LOAD_AND_QUANTIZE_TEST_PARAMS.keys())) |
| 10438 | def test_pool_load_and_quantize(pool_file, column_description, load_params, quantize_params, |
| 10439 | subset_quantization_differs): |
| 10440 | SMALL_BLOCK_SIZE = 500 |
| 10441 | SMALL_SUBSET_SIZE_FOR_BUILD_BORDERS = 100 |
| 10442 | quantized_pool = Pool(pool_file, column_description=column_description, **load_params) |
| 10443 | quantized_pool.quantize(**quantize_params) |
| 10444 | |
| 10445 | quantized_pool_small_subset = Pool(pool_file, column_description=column_description, **load_params) |
| 10446 | quantized_pool_small_subset.quantize( |
| 10447 | dev_max_subset_size_for_build_borders=SMALL_SUBSET_SIZE_FOR_BUILD_BORDERS, |
| 10448 | **quantize_params) |
| 10449 | |
| 10450 | quantize_on_load_params = quantize_params.copy() |
| 10451 | quantize_on_load_params.update(load_params) |
| 10452 | |
| 10453 | quantized_on_load_pool = quantize(pool_file, column_description=column_description, **quantize_on_load_params) |
| 10454 | quantized_on_load_pool_small_blocks = quantize( |
| 10455 | pool_file, |
| 10456 | column_description=column_description, |
| 10457 | dev_block_size=SMALL_BLOCK_SIZE, |
| 10458 | **quantize_on_load_params) |
| 10459 | quantized_on_load_pool_small_subset = quantize( |
| 10460 | pool_file, |
| 10461 | column_description=column_description, |
| 10462 | dev_max_subset_size_for_build_borders=SMALL_SUBSET_SIZE_FOR_BUILD_BORDERS, |
| 10463 | **quantize_on_load_params) |
| 10464 | quantized_on_load_pool_small_blocks_and_subset = quantize( |
| 10465 | pool_file, |
| 10466 | column_description=column_description, |
| 10467 | dev_block_size=SMALL_BLOCK_SIZE, |
| 10468 | dev_max_subset_size_for_build_borders=SMALL_SUBSET_SIZE_FOR_BUILD_BORDERS, |
| 10469 | **quantize_on_load_params) |
| 10470 | |
| 10471 | assert quantized_on_load_pool.is_quantized() |
| 10472 | assert quantized_pool == quantized_on_load_pool |
| 10473 | assert quantized_pool == quantized_on_load_pool_small_blocks |
| 10474 | |
| 10475 | assert (quantized_pool != quantized_pool_small_subset) == subset_quantization_differs |
| 10476 | assert quantized_pool_small_subset == quantized_on_load_pool_small_subset |
| 10477 | assert quantized_pool_small_subset == quantized_on_load_pool_small_blocks_and_subset |
| 10478 | |
| 10479 | if load_params or quantize_params: |
| 10480 | quantized_without_params_pool = Pool(pool_file, column_description=column_description) |
| 10481 | quantized_without_params_pool.quantize() |
| 10482 | assert quantized_pool != quantized_without_params_pool |
| 10483 | |
| 10484 | |
| 10485 | def test_pool_load_and_quantize_unknown_param(): |