Skip to content

Commit

Permalink
Add warning on adding nbits to LSH index factory (#3687)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #3687

We will write a warning if nbits is not specified while using index factory with LSH. The warning lets users know we will be using default d as nbits.

Reviewed By: ramilbakhshyiev

Differential Revision: D60187935

fbshipit-source-id: 0fa960eeed615d857add77fa131a4cfa1989809d
  • Loading branch information
bshethmeta authored and facebook-github-bot committed Jul 25, 2024
1 parent aed7b0e commit 0363934
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion faiss/index_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,15 @@ Index* parse_other_indexes(

// IndexLSH
if (match("LSH([0-9]*)(r?)(t?)")) {
int nbits = sm[1].length() > 0 ? std::stoi(sm[1].str()) : d;
int nbits;
if (sm[1].length() > 0) {
nbits = std::stoi(sm[1].str());
} else {
nbits = d;
fprintf(stderr,
"WARN: nbits not specified, defaulting to d = %d\n",
d);
}
bool rotate_data = sm[2].length() > 0;
bool train_thresholds = sm[3].length() > 0;
FAISS_THROW_IF_NOT(metric == METRIC_L2);
Expand Down

0 comments on commit 0363934

Please sign in to comment.