test: stabilize DiskANN and IVF searcher tests (#637)
This commit is contained in:
@@ -2552,11 +2552,23 @@ TEST_F(IVFSearcherTest, TestQuantizedPerCentroid) {
|
||||
|
||||
const IndexDocumentList &result = context->result(0);
|
||||
EXPECT_EQ((size_t)topk, result.size());
|
||||
uint64_t max_rank_error = 0;
|
||||
uint64_t total_rank_error = 0;
|
||||
for (size_t i = 0; i < topk; ++i) {
|
||||
ASSERT_NEAR((uint64_t)(total - 1) - i, result[i].key(), 150);
|
||||
const uint64_t expected_key = (uint64_t)(total - 1) - i;
|
||||
const uint64_t actual_key = result[i].key();
|
||||
const uint64_t rank_error = expected_key > actual_key
|
||||
? expected_key - actual_key
|
||||
: actual_key - expected_key;
|
||||
max_rank_error = std::max(max_rank_error, rank_error);
|
||||
total_rank_error += rank_error;
|
||||
float expect = (float)result[i].key() * 500.0f * dimension_;
|
||||
ASSERT_NEAR(expect, std::abs(result[i].score()), expect * 0.2 + 500000);
|
||||
}
|
||||
// K-means initialization and int8 score ties can vary by platform. Check
|
||||
// the overall approximate ranking quality without rejecting one outlier.
|
||||
EXPECT_LE(max_rank_error, 200U);
|
||||
EXPECT_LE(total_rank_error, topk * 30U);
|
||||
}
|
||||
|
||||
// batch bf serch
|
||||
|
||||
Reference in New Issue
Block a user