Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
93981add
milvus
项目概览
qq_35024513
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
14
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
93981add
编写于
11月 20, 2019
作者:
G
groot
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'source/0.6.0' into 0.6.0
上级
3beea540
1c7ac286
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
0 addition
and
125 deletion
+0
-125
core/src/wrapper/VecImpl.cpp
core/src/wrapper/VecImpl.cpp
+0
-125
未找到文件。
core/src/wrapper/VecImpl.cpp
浏览文件 @
93981add
...
...
@@ -248,130 +248,5 @@ BFIndex::BuildAll(const int64_t& nb, const float* xb, const int64_t* ids, const
return
Status
::
OK
();
}
// TODO(linxj): add lock here.
Status
IVFMixIndex
::
BuildAll
(
const
int64_t
&
nb
,
const
float
*
xb
,
const
int64_t
*
ids
,
const
Config
&
cfg
,
const
int64_t
&
nt
,
const
float
*
xt
)
{
try
{
dim
=
cfg
->
d
;
auto
dataset
=
GenDatasetWithIds
(
nb
,
dim
,
xb
,
ids
);
auto
preprocessor
=
index_
->
BuildPreprocessor
(
dataset
,
cfg
);
index_
->
set_preprocessor
(
preprocessor
);
auto
model
=
index_
->
Train
(
dataset
,
cfg
);
index_
->
set_index_model
(
model
);
index_
->
Add
(
dataset
,
cfg
);
if
(
auto
device_index
=
std
::
dynamic_pointer_cast
<
knowhere
::
GPUIndex
>
(
index_
))
{
auto
host_index
=
device_index
->
CopyGpuToCpu
(
Config
());
index_
=
host_index
;
type
=
ConvertToCpuIndexType
(
type
);
}
else
{
WRAPPER_LOG_ERROR
<<
"Build IVFMIXIndex Failed"
;
return
Status
(
KNOWHERE_ERROR
,
"Build IVFMIXIndex Failed"
);
}
}
catch
(
knowhere
::
KnowhereException
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
return
Status
(
KNOWHERE_UNEXPECTED_ERROR
,
e
.
what
());
}
catch
(
std
::
exception
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
return
Status
(
KNOWHERE_ERROR
,
e
.
what
());
}
return
Status
::
OK
();
}
Status
IVFMixIndex
::
Load
(
const
knowhere
::
BinarySet
&
index_binary
)
{
index_
->
Load
(
index_binary
);
dim
=
Dimension
();
return
Status
::
OK
();
}
knowhere
::
QuantizerPtr
IVFHybridIndex
::
LoadQuantizer
(
const
Config
&
conf
)
{
// TODO(linxj): Hardcode here
if
(
auto
new_idx
=
std
::
dynamic_pointer_cast
<
knowhere
::
IVFSQHybrid
>
(
index_
))
{
return
new_idx
->
LoadQuantizer
(
conf
);
}
else
{
WRAPPER_LOG_ERROR
<<
"Hybrid mode not supported for index type: "
<<
int
(
type
);
}
}
Status
IVFHybridIndex
::
SetQuantizer
(
const
knowhere
::
QuantizerPtr
&
q
)
{
try
{
// TODO(linxj): Hardcode here
if
(
auto
new_idx
=
std
::
dynamic_pointer_cast
<
knowhere
::
IVFSQHybrid
>
(
index_
))
{
new_idx
->
SetQuantizer
(
q
);
}
else
{
WRAPPER_LOG_ERROR
<<
"Hybrid mode not supported for index type: "
<<
int
(
type
);
return
Status
(
KNOWHERE_ERROR
,
"not supported"
);
}
}
catch
(
knowhere
::
KnowhereException
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
return
Status
(
KNOWHERE_UNEXPECTED_ERROR
,
e
.
what
());
}
catch
(
std
::
exception
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
return
Status
(
KNOWHERE_ERROR
,
e
.
what
());
}
return
Status
::
OK
();
}
Status
IVFHybridIndex
::
UnsetQuantizer
()
{
try
{
// TODO(linxj): Hardcode here
if
(
auto
new_idx
=
std
::
dynamic_pointer_cast
<
knowhere
::
IVFSQHybrid
>
(
index_
))
{
new_idx
->
UnsetQuantizer
();
}
else
{
WRAPPER_LOG_ERROR
<<
"Hybrid mode not supported for index type: "
<<
int
(
type
);
return
Status
(
KNOWHERE_ERROR
,
"not supported"
);
}
}
catch
(
knowhere
::
KnowhereException
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
return
Status
(
KNOWHERE_UNEXPECTED_ERROR
,
e
.
what
());
}
catch
(
std
::
exception
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
return
Status
(
KNOWHERE_ERROR
,
e
.
what
());
}
return
Status
::
OK
();
}
VecIndexPtr
IVFHybridIndex
::
LoadData
(
const
knowhere
::
QuantizerPtr
&
q
,
const
Config
&
conf
)
{
try
{
// TODO(linxj): Hardcode here
if
(
auto
new_idx
=
std
::
dynamic_pointer_cast
<
knowhere
::
IVFSQHybrid
>
(
index_
))
{
return
std
::
make_shared
<
IVFHybridIndex
>
(
new_idx
->
LoadData
(
q
,
conf
),
type
);
}
else
{
WRAPPER_LOG_ERROR
<<
"Hybrid mode not supported for index type: "
<<
int
(
type
);
}
}
catch
(
knowhere
::
KnowhereException
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
}
catch
(
std
::
exception
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
}
return
nullptr
;
}
std
::
pair
<
VecIndexPtr
,
knowhere
::
QuantizerPtr
>
IVFHybridIndex
::
CopyToGpuWithQuantizer
(
const
int64_t
&
device_id
,
const
Config
&
cfg
)
{
try
{
// TODO(linxj): Hardcode here
if
(
auto
hybrid_idx
=
std
::
dynamic_pointer_cast
<
knowhere
::
IVFSQHybrid
>
(
index_
))
{
auto
pair
=
hybrid_idx
->
CopyCpuToGpuWithQuantizer
(
device_id
,
cfg
);
auto
new_idx
=
std
::
make_shared
<
IVFHybridIndex
>
(
pair
.
first
,
type
);
return
std
::
make_pair
(
new_idx
,
pair
.
second
);
}
else
{
WRAPPER_LOG_ERROR
<<
"Hybrid mode not supported for index type: "
<<
int
(
type
);
}
}
catch
(
knowhere
::
KnowhereException
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
}
catch
(
std
::
exception
&
e
)
{
WRAPPER_LOG_ERROR
<<
e
.
what
();
}
return
std
::
make_pair
(
nullptr
,
nullptr
);
}
}
// namespace engine
}
// namespace milvus
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录