Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
f9222da5
M
milvus
项目概览
milvus
/
milvus
9 个月 前同步成功
通知
260
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
f9222da5
编写于
12月 23, 2020
作者:
S
shengjun.li
提交者:
GitHub
12月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix MapOffsetToUid (#4493)
Signed-off-by:
N
shengjun.li
<
shengjun.li@zilliz.com
>
上级
705e5cde
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
8 addition
and
14 deletion
+8
-14
core/src/index/knowhere/knowhere/index/vector_index/IndexBinaryIDMAP.cpp
...knowhere/knowhere/index/vector_index/IndexBinaryIDMAP.cpp
+2
-2
core/src/index/knowhere/knowhere/index/vector_index/IndexBinaryIVF.cpp
...x/knowhere/knowhere/index/vector_index/IndexBinaryIVF.cpp
+1
-2
core/src/index/knowhere/knowhere/index/vector_index/IndexIDMAP.cpp
...index/knowhere/knowhere/index/vector_index/IndexIDMAP.cpp
+2
-2
core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp
...c/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp
+1
-2
core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp
...nowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp
+0
-2
core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIVF.cpp
.../knowhere/knowhere/index/vector_index/gpu/IndexGPUIVF.cpp
+0
-2
core/src/index/unittest/test_annoy.cpp
core/src/index/unittest/test_annoy.cpp
+2
-2
未找到文件。
core/src/index/knowhere/knowhere/index/vector_index/IndexBinaryIDMAP.cpp
浏览文件 @
f9222da5
...
...
@@ -51,6 +51,8 @@ BinaryIDMAP::Query(const DatasetPtr& dataset_ptr, const Config& config) {
auto
p_dist
=
(
float
*
)
malloc
(
p_dist_size
);
QueryImpl
(
rows
,
(
uint8_t
*
)
p_data
,
k
,
p_dist
,
p_id
,
config
);
MapOffsetToUid
(
p_id
,
static_cast
<
size_t
>
(
elems
));
auto
ret_ds
=
std
::
make_shared
<
Dataset
>
();
ret_ds
->
Set
(
meta
::
IDS
,
p_id
);
ret_ds
->
Set
(
meta
::
DISTANCE
,
p_dist
);
...
...
@@ -122,8 +124,6 @@ BinaryIDMAP::QueryImpl(int64_t n, const uint8_t* data, int64_t k, float* distanc
}
index_
->
metric_type
=
default_type
;
MapOffsetToUid
(
labels
,
static_cast
<
size_t
>
(
n
*
k
));
}
}
// namespace knowhere
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexBinaryIVF.cpp
浏览文件 @
f9222da5
...
...
@@ -58,6 +58,7 @@ BinaryIVF::Query(const DatasetPtr& dataset_ptr, const Config& config) {
auto
p_dist
=
(
float
*
)
malloc
(
p_dist_size
);
QueryImpl
(
rows
,
(
uint8_t
*
)
p_data
,
k
,
p_dist
,
p_id
,
config
);
MapOffsetToUid
(
p_id
,
static_cast
<
size_t
>
(
elems
));
auto
ret_ds
=
std
::
make_shared
<
Dataset
>
();
ret_ds
->
Set
(
meta
::
IDS
,
p_id
);
...
...
@@ -187,8 +188,6 @@ BinaryIVF::QueryImpl(int64_t n, const uint8_t* data, int64_t k, float* distances
distances
[
i
]
=
static_cast
<
float
>
(
i_distances
[
i
]);
}
}
MapOffsetToUid
(
labels
,
static_cast
<
size_t
>
(
n
*
k
));
}
}
// namespace knowhere
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexIDMAP.cpp
浏览文件 @
f9222da5
...
...
@@ -82,6 +82,8 @@ IDMAP::Query(const DatasetPtr& dataset_ptr, const Config& config) {
auto
p_dist
=
(
float
*
)
malloc
(
p_dist_size
);
QueryImpl
(
rows
,
(
float
*
)
p_data
,
k
,
p_dist
,
p_id
,
config
);
MapOffsetToUid
(
p_id
,
static_cast
<
size_t
>
(
elems
));
auto
ret_ds
=
std
::
make_shared
<
Dataset
>
();
ret_ds
->
Set
(
meta
::
IDS
,
p_id
);
ret_ds
->
Set
(
meta
::
DISTANCE
,
p_dist
);
...
...
@@ -139,8 +141,6 @@ IDMAP::QueryImpl(int64_t n, const float* data, int64_t k, float* distances, int6
index_
->
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
index_
->
search
(
n
,
(
float
*
)
data
,
k
,
distances
,
labels
,
GetBlacklist
());
index_
->
metric_type
=
default_type
;
MapOffsetToUid
(
labels
,
static_cast
<
size_t
>
(
n
*
k
));
}
}
// namespace knowhere
...
...
core/src/index/knowhere/knowhere/index/vector_index/IndexIVF.cpp
浏览文件 @
f9222da5
...
...
@@ -104,6 +104,7 @@ IVF::Query(const DatasetPtr& dataset_ptr, const Config& config) {
auto
p_dist
=
(
float
*
)
malloc
(
p_dist_size
);
QueryImpl
(
rows
,
(
float
*
)
p_data
,
k
,
p_dist
,
p_id
,
config
);
MapOffsetToUid
(
p_id
,
static_cast
<
size_t
>
(
elems
));
auto
ret_ds
=
std
::
make_shared
<
Dataset
>
();
ret_ds
->
Set
(
meta
::
IDS
,
p_id
);
...
...
@@ -311,8 +312,6 @@ IVF::QueryImpl(int64_t n, const float* data, int64_t k, float* distances, int64_
<<
", data search cost: "
<<
faiss
::
indexIVF_stats
.
search_time
;
faiss
::
indexIVF_stats
.
quantization_time
=
0
;
faiss
::
indexIVF_stats
.
search_time
=
0
;
MapOffsetToUid
(
labels
,
static_cast
<
size_t
>
(
n
*
k
));
}
void
...
...
core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIDMAP.cpp
浏览文件 @
f9222da5
...
...
@@ -105,8 +105,6 @@ GPUIDMAP::QueryImpl(int64_t n, const float* data, int64_t k, float* distances, i
index_
->
metric_type
=
GetMetricType
(
config
[
Metric
::
TYPE
].
get
<
std
::
string
>
());
index_
->
search
(
n
,
(
float
*
)
data
,
k
,
distances
,
labels
,
GetBlacklist
());
index_
->
metric_type
=
default_type
;
MapOffsetToUid
(
labels
,
static_cast
<
size_t
>
(
n
*
k
));
}
void
...
...
core/src/index/knowhere/knowhere/index/vector_index/gpu/IndexGPUIVF.cpp
浏览文件 @
f9222da5
...
...
@@ -148,8 +148,6 @@ GPUIVF::QueryImpl(int64_t n, const float* data, int64_t k, float* distances, int
device_index
->
search
(
search_size
,
(
float
*
)
data
+
i
*
dim
,
k
,
distances
+
i
*
k
,
labels
+
i
*
k
,
GetBlacklist
());
}
MapOffsetToUid
(
labels
,
static_cast
<
size_t
>
(
n
*
k
));
}
else
{
KNOWHERE_THROW_MSG
(
"Not a GpuIndexIVF type."
);
}
...
...
core/src/index/unittest/test_annoy.cpp
浏览文件 @
f9222da5
...
...
@@ -60,7 +60,7 @@ TEST_P(AnnoyTest, annoy_basic) {
ASSERT_ANY_THROW
(
index_
->
Dim
());
}
index_
->
BuildAll
(
base_dataset
,
conf
);
// Train + Add
index_
->
BuildAll
(
base_dataset
,
conf
);
// Train + Add
WithoutIds
ASSERT_EQ
(
index_
->
Count
(),
nb
);
ASSERT_EQ
(
index_
->
Dim
(),
dim
);
...
...
@@ -94,7 +94,7 @@ TEST_P(AnnoyTest, annoy_basic) {
TEST_P
(
AnnoyTest
,
annoy_delete
)
{
assert
(
!
xb
.
empty
());
index_
->
BuildAll
(
base_dataset
,
conf
);
// Train + Add
index_
->
BuildAll
(
base_dataset
,
conf
);
// Train + Add
WithoutIds
ASSERT_EQ
(
index_
->
Count
(),
nb
);
ASSERT_EQ
(
index_
->
Dim
(),
dim
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录