faiss: Failed: direct map is not initialized in C++

Summary

Hi, i am trying to do reconstruct index in C++ and i got this error

terminating with uncaught exception of type faiss::FaissException: Error in virtual void faiss::IndexIVF::reconstruct(faiss::Index::idx_t, float *) const at IndexIVF.cpp:612: Error: 'direct_map.size() == ntotal' failed: direct map is not initialized

any idea how to solve this on C++? mostly I see the issue that already in here is for python, I haven’t seen it on C++. You can see my code here :

https://pastebin.com/mKwXmTB1

Platform

OS: macOS High Sierra

Faiss version: Latest

Faiss compilation options:

Running on:

  • CPU
  • GPU

Interface:

  • C++
  • Python

Reproduction instructions

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Something in the lines of

extract_index_ivf(index)->make_direct_map()