Skip to content

Commit 0363934

Browse files
bshethmetafacebook-github-bot
authored andcommitted
Add warning on adding nbits to LSH index factory (facebookresearch#3687)
Summary: Pull Request resolved: facebookresearch#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
1 parent aed7b0e commit 0363934

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

faiss/index_factory.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,15 @@ Index* parse_other_indexes(
531531

532532
// IndexLSH
533533
if (match("LSH([0-9]*)(r?)(t?)")) {
534-
int nbits = sm[1].length() > 0 ? std::stoi(sm[1].str()) : d;
534+
int nbits;
535+
if (sm[1].length() > 0) {
536+
nbits = std::stoi(sm[1].str());
537+
} else {
538+
nbits = d;
539+
fprintf(stderr,
540+
"WARN: nbits not specified, defaulting to d = %d\n",
541+
d);
542+
}
535543
bool rotate_data = sm[2].length() > 0;
536544
bool train_thresholds = sm[3].length() > 0;
537545
FAISS_THROW_IF_NOT(metric == METRIC_L2);

0 commit comments

Comments
 (0)