Skip to content

Writing and reading IndexIDMap (C++) #3661

Closed Answered by frootonator
frootonator asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I've looked up to source code of the library and both methods use dynamic_cast inside them. So the correct way is:

faiss::IndexIDMap index = faiss::IndexIDMap(indexHNSW);
faiss::write_index(dynamic_cast<const faiss::Index *>(indexHNSW), "path.index");
faiss::Index * index = faiss::read_index("path.index");
faiss::IndexHNSWFlat * indexHNSW = dynamic_cast<faiss::IndexHNSWFlat *>(index);

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by frootonator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #3647 on July 22, 2024 20:04.