Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
d318a34e
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看板
提交
d318a34e
编写于
10月 14, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add clear act when dealloc
上级
fe589d43
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
4 deletion
+16
-4
src/io/api_paddle_mobile.cc
src/io/api_paddle_mobile.cc
+5
-0
src/io/api_paddle_mobile.h
src/io/api_paddle_mobile.h
+2
-2
src/io/paddle_inference_api.h
src/io/paddle_inference_api.h
+3
-1
test/framework/test_inference_api.cpp
test/framework/test_inference_api.cpp
+6
-1
未找到文件。
src/io/api_paddle_mobile.cc
浏览文件 @
d318a34e
...
@@ -101,6 +101,11 @@ bool PaddleMobilePredictor<Dtype, P>::Run(
...
@@ -101,6 +101,11 @@ bool PaddleMobilePredictor<Dtype, P>::Run(
return
true
;
return
true
;
}
}
template
<
typename
Dtype
,
Precision
P
>
PaddleMobilePredictor
<
Dtype
,
P
>::~
PaddleMobilePredictor
()
{
paddle_mobile_
->
Clear
();
}
// A factory to help create difference predictor.
// A factory to help create difference predictor.
template
<
>
template
<
>
std
::
unique_ptr
<
PaddlePredictor
>
std
::
unique_ptr
<
PaddlePredictor
>
...
...
src/io/api_paddle_mobile.h
浏览文件 @
d318a34e
...
@@ -32,7 +32,7 @@ namespace paddle_mobile {
...
@@ -32,7 +32,7 @@ namespace paddle_mobile {
template
<
typename
Dtype
=
CPU
,
Precision
P
=
Precision
::
FP32
>
template
<
typename
Dtype
=
CPU
,
Precision
P
=
Precision
::
FP32
>
class
PaddleMobilePredictor
:
public
PaddlePredictor
{
class
PaddleMobilePredictor
:
public
PaddlePredictor
{
public:
public:
PaddleMobilePredictor
()
{}
PaddleMobilePredictor
()
=
delete
;
explicit
PaddleMobilePredictor
(
const
PaddleMobileConfig
&
config
);
explicit
PaddleMobilePredictor
(
const
PaddleMobileConfig
&
config
);
...
@@ -40,7 +40,7 @@ class PaddleMobilePredictor : public PaddlePredictor {
...
@@ -40,7 +40,7 @@ class PaddleMobilePredictor : public PaddlePredictor {
std
::
vector
<
PaddleTensor
>*
output_data
,
std
::
vector
<
PaddleTensor
>*
output_data
,
int
batch_size
=
-
1
)
override
;
int
batch_size
=
-
1
)
override
;
~
PaddleMobilePredictor
()
override
{}
;
~
PaddleMobilePredictor
()
override
;
private:
private:
std
::
unique_ptr
<
PaddleMobile
<
Dtype
,
P
>>
paddle_mobile_
;
std
::
unique_ptr
<
PaddleMobile
<
Dtype
,
P
>>
paddle_mobile_
;
...
...
src/io/paddle_inference_api.h
浏览文件 @
d318a34e
...
@@ -87,7 +87,6 @@ enum class PaddleEngineKind {
...
@@ -87,7 +87,6 @@ enum class PaddleEngineKind {
class
PaddlePredictor
{
class
PaddlePredictor
{
public:
public:
struct
Config
;
struct
Config
;
PaddlePredictor
()
=
default
;
PaddlePredictor
(
const
PaddlePredictor
&
)
=
delete
;
PaddlePredictor
(
const
PaddlePredictor
&
)
=
delete
;
PaddlePredictor
&
operator
=
(
const
PaddlePredictor
&
)
=
delete
;
PaddlePredictor
&
operator
=
(
const
PaddlePredictor
&
)
=
delete
;
...
@@ -107,6 +106,9 @@ class PaddlePredictor {
...
@@ -107,6 +106,9 @@ class PaddlePredictor {
struct
Config
{
struct
Config
{
std
::
string
model_dir
;
// path to the model directory.
std
::
string
model_dir
;
// path to the model directory.
};
};
protected:
PaddlePredictor
()
=
default
;
};
};
struct
PaddleMobileConfig
:
public
PaddlePredictor
::
Config
{
struct
PaddleMobileConfig
:
public
PaddlePredictor
::
Config
{
...
...
test/framework/test_inference_api.cpp
浏览文件 @
d318a34e
...
@@ -46,7 +46,12 @@ int main() {
...
@@ -46,7 +46,12 @@ int main() {
tensor_out
.
dtype
=
PaddleDType
::
FLOAT32
;
tensor_out
.
dtype
=
PaddleDType
::
FLOAT32
;
std
::
vector
<
PaddleTensor
>
outputs
(
1
,
tensor_out
);
std
::
vector
<
PaddleTensor
>
outputs
(
1
,
tensor_out
);
assert
(
predictor
->
Run
(
paddle_tensor_feeds
,
&
outputs
));
std
::
cout
<<
" before predict "
<<
std
::
endl
;
predictor
->
Run
(
paddle_tensor_feeds
,
&
outputs
);
std
::
cout
<<
" after predict "
<<
std
::
endl
;
// assert();
float
*
data_o
=
static_cast
<
float
*>
(
outputs
[
0
].
data
.
data
());
float
*
data_o
=
static_cast
<
float
*>
(
outputs
[
0
].
data
.
data
());
for
(
size_t
j
=
0
;
j
<
outputs
[
0
].
data
.
length
()
/
sizeof
(
float
);
++
j
)
{
for
(
size_t
j
=
0
;
j
<
outputs
[
0
].
data
.
length
()
/
sizeof
(
float
);
++
j
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录