mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 12:59:23 +08:00
fix binary flat may retruns wrong distance when nq larger than 1 (#1760)
Signed-off-by: shengjun.li <shengjun.li@zilliz.com>
This commit is contained in:
parent
c4b7be8ed6
commit
e9f7422bc5
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user