未验证 提交 e9f7422b 编写于 作者: S shengjun.li 提交者: GitHub

fix binary flat may retruns wrong distance when nq larger than 1 (#1760)

Signed-off-by: Nshengjun.li <shengjun.li@zilliz.com>
上级 c4b7be8e
......@@ -209,7 +209,7 @@ void binary_distence_knn_mc(
}
}
}
for (size_t i = 0, ni = 0; i < n1; i++) {
for (size_t i = 0; i < n1; i++) {
size_t n_i = 0;
float *distances_i = distances + i * k;
int64_t *labels_i = labels + i * k;
......@@ -218,7 +218,7 @@ void binary_distence_knn_mc(
size_t match_index = t * n1 + i;
size_t copy_num = std::min(k - n_i, match_num[match_index]);
memcpy(labels_i + n_i, match_data + match_index * k, copy_num * sizeof(int64_t));
memset(distances + n_i, 0, copy_num * sizeof(int32_t));
memset(distances_i + n_i, 0, copy_num * sizeof(float));
n_i += copy_num;
}
for (; n_i < k; n_i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册