Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
f66e4a5e
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f66e4a5e
编写于
4月 26, 2020
作者:
D
DannyIsFunny
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=develop
上级
97c10e3e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
26 deletion
+31
-26
lite/api/cxx_api_impl.cc
lite/api/cxx_api_impl.cc
+31
-26
未找到文件。
lite/api/cxx_api_impl.cc
浏览文件 @
f66e4a5e
...
@@ -34,38 +34,43 @@ namespace lite {
...
@@ -34,38 +34,43 @@ namespace lite {
void
CxxPaddleApiImpl
::
Init
(
const
lite_api
::
CxxConfig
&
config
)
{
void
CxxPaddleApiImpl
::
Init
(
const
lite_api
::
CxxConfig
&
config
)
{
config_
=
config
;
config_
=
config
;
auto
places
=
config
.
valid_places
();
if
(
!
status_is_cloned_
)
{
std
::
vector
<
std
::
string
>
passes
{};
auto
places
=
config
.
valid_places
();
std
::
vector
<
std
::
string
>
passes
{};
#ifdef LITE_WITH_CUDA
#ifdef LITE_WITH_CUDA
// if kCUDA is included in valid places, it should be initialized first,
// if kCUDA is included in valid places, it should be initialized first,
// otherwise skip this step.
// otherwise skip this step.
for
(
auto
&
p
:
places
)
{
for
(
auto
&
p
:
places
)
{
if
(
p
.
target
==
TARGET
(
kCUDA
))
{
if
(
p
.
target
==
TARGET
(
kCUDA
))
{
Env
<
TARGET
(
kCUDA
)
>::
Init
();
Env
<
TARGET
(
kCUDA
)
>::
Init
();
if
(
config_
.
multi_stream
())
{
if
(
config_
.
multi_stream
())
{
passes
=
{
"multi_stream_analysis_pass"
};
passes
=
{
"multi_stream_analysis_pass"
};
VLOG
(
3
)
<<
"add pass: "
<<
passes
[
0
];
VLOG
(
3
)
<<
"add pass: "
<<
passes
[
0
];
}
break
;
}
}
break
;
}
}
}
#endif
#endif
#ifdef LITE_WITH_MLU
#ifdef LITE_WITH_MLU
Env
<
TARGET
(
kMLU
)
>::
Init
();
Env
<
TARGET
(
kMLU
)
>::
Init
();
lite
::
DeviceInfo
::
Global
().
SetMLURunMode
(
config
.
mlu_core_version
(),
lite
::
DeviceInfo
::
Global
().
SetMLURunMode
(
config
.
mlu_core_version
(),
config
.
mlu_core_number
(),
config
.
mlu_core_number
(),
config
.
mlu_use_first_conv
(),
config
.
mlu_use_first_conv
(),
config
.
mlu_first_conv_mean
(),
config
.
mlu_first_conv_mean
(),
config
.
mlu_first_conv_std
(),
config
.
mlu_first_conv_std
(),
config
.
mlu_input_layout
());
config
.
mlu_input_layout
());
#endif // LITE_WITH_MLU
#endif // LITE_WITH_MLU
auto
use_layout_preprocess_pass
=
auto
use_layout_preprocess_pass
=
config
.
model_dir
().
find
(
"OPENCL_PRE_PRECESS"
);
config
.
model_dir
().
find
(
"OPENCL_PRE_PRECESS"
);
VLOG
(
1
)
<<
"use_layout_preprocess_pass:"
<<
use_layout_preprocess_pass
;
VLOG
(
1
)
<<
"use_layout_preprocess_pass:"
<<
use_layout_preprocess_pass
;
if
(
places
[
0
].
target
==
TARGET
(
kOpenCL
)
&&
if
(
places
[
0
].
target
==
TARGET
(
kOpenCL
)
&&
use_layout_preprocess_pass
!=
std
::
string
::
npos
)
{
use_layout_preprocess_pass
!=
std
::
string
::
npos
)
{
passes
=
{
"type_layout_cast_preprocess_pass"
};
passes
=
{
"type_layout_cast_preprocess_pass"
};
VLOG
(
1
)
<<
"add pass:"
<<
passes
[
0
];
VLOG
(
1
)
<<
"add pass:"
<<
passes
[
0
];
}
raw_predictor_
->
Build
(
config
,
places
,
passes
);
}
else
{
CHECK
(
raw_predictor_
)
<<
"The Predictor can not be nullptr in Clone mode."
;
}
}
mode_
=
config
.
power_mode
();
mode_
=
config
.
power_mode
();
threads_
=
config
.
threads
();
threads_
=
config
.
threads
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录