mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-11 22:50:00 +00:00
Fix Faiss fp16 parity tests across architectures (#5695)
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/5695 Correct GPU tests to decode the exact packed fp16 values passed to `search_ex`; the generic software converter and legacy `roundToHalf` disagree on half-way ties. Keep labels exact while comparing CPU distances with the normal scaled `1e-5` BLAS/SIMD tolerance. ___ Differential Revision: D122785161 fbshipit-source-id: 057ded12bdc018add4bef39e514217b83b59c2cb
This commit is contained in:
committed by
meta-codesync[bot]
parent
430a41ee4c
commit
38460ee969
@@ -8,6 +8,7 @@
|
||||
#include <omp.h>
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <map>
|
||||
@@ -1165,8 +1166,14 @@ TEST(IndexFlat, search_ex_float16_native_matches_float32) {
|
||||
hi.data());
|
||||
EXPECT_EQ(hi, fi)
|
||||
<< "metric=" << metric << " d=" << d << " k=" << k;
|
||||
EXPECT_EQ(hd, fd)
|
||||
<< "metric=" << metric << " d=" << d << " k=" << k;
|
||||
for (size_t i = 0; i < fd.size(); ++i) {
|
||||
EXPECT_NEAR(
|
||||
hd[i],
|
||||
fd[i],
|
||||
1e-5f * std::max(1.0f, std::fabs(fd[i])))
|
||||
<< "metric=" << metric << " d=" << d << " k=" << k
|
||||
<< " result=" << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user