Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remove ids for indexrefine #4026

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions faiss/IndexRefine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ void IndexRefine::add(idx_t n, const float* x) {
ntotal = refine_index->ntotal;
}

size_t IndexRefine::remove_ids(const IDSelector& sel) {
FAISS_THROW_IF_NOT(is_trained);
base_index->remove_ids(sel);
refine_index->remove_ids(sel);
ntotal = refine_index->ntotal;
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the return value is supposed to be the number of vectors removed. You should be able to do this by getting the ntotal of the refine_index (or base_index - they should be the same) before applying the remove_ids operation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I will fix it

}

void IndexRefine::reset() {
base_index->reset();
refine_index->reset();
Expand Down
2 changes: 2 additions & 0 deletions faiss/IndexRefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ struct IndexRefine : Index {

void add(idx_t n, const float* x) override;

size_t remove_ids(const IDSelector& sel) override;

void reset() override;

void search(
Expand Down
Loading