Commit 5d1ed5b6 authored by Pierre Letessier's avatar Pierre Letessier Committed by Lucas Hosseini

Fix unable to read untrained index (#817)

parent 012954eb
...@@ -866,15 +866,17 @@ static IndexIVFPQ *read_ivfpq (IOReader *f, uint32_t h, int io_flags) ...@@ -866,15 +866,17 @@ static IndexIVFPQ *read_ivfpq (IOReader *f, uint32_t h, int io_flags)
read_InvertedLists (ivpq, f, io_flags); read_InvertedLists (ivpq, f, io_flags);
} }
if (ivpq->is_trained) {
// precomputed table not stored. It is cheaper to recompute it // precomputed table not stored. It is cheaper to recompute it
ivpq->use_precomputed_table = 0; ivpq->use_precomputed_table = 0;
if (ivpq->by_residual) if (ivpq->by_residual)
ivpq->precompute_table (); ivpq->precompute_table();
if (ivfpqr) { if (ivfpqr) {
read_ProductQuantizer (&ivfpqr->refine_pq, f); read_ProductQuantizer(&ivfpqr->refine_pq, f);
READVECTOR (ivfpqr->refine_codes); READVECTOR (ivfpqr->refine_codes);
READ1 (ivfpqr->k_factor); READ1 (ivfpqr->k_factor);
} }
}
return ivpq; return ivpq;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment