Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
39ad0c74
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
338
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看板
提交
39ad0c74
编写于
11月 26, 2019
作者:
开心的小妮
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[LITE][API] Add GetOutput API for CXX and Mobile. test=develop
上级
af661abe
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
0 deletion
+22
-0
lite/api/cxx_api.h
lite/api/cxx_api.h
+3
-0
lite/api/cxx_api_impl.cc
lite/api/cxx_api_impl.cc
+5
-0
lite/api/light_api.h
lite/api/light_api.h
+4
-0
lite/api/light_api_impl.cc
lite/api/light_api_impl.cc
+6
-0
lite/api/paddle_api.h
lite/api/paddle_api.h
+4
-0
未找到文件。
lite/api/cxx_api.h
浏览文件 @
39ad0c74
...
@@ -88,6 +88,7 @@ class LITE_API Predictor {
...
@@ -88,6 +88,7 @@ class LITE_API Predictor {
// Get offset-th col of fetch results.
// Get offset-th col of fetch results.
const
lite
::
Tensor
*
GetOutput
(
size_t
offset
)
const
;
const
lite
::
Tensor
*
GetOutput
(
size_t
offset
)
const
;
const
lite
::
Tensor
*
GetOutput
(
const
std
::
string
&
name
)
const
;
std
::
vector
<
const
lite
::
Tensor
*>
GetOutputs
()
const
;
std
::
vector
<
const
lite
::
Tensor
*>
GetOutputs
()
const
;
const
cpp
::
ProgramDesc
&
program_desc
()
const
;
const
cpp
::
ProgramDesc
&
program_desc
()
const
;
...
@@ -131,6 +132,8 @@ class CxxPaddleApiImpl : public lite_api::PaddlePredictor {
...
@@ -131,6 +132,8 @@ class CxxPaddleApiImpl : public lite_api::PaddlePredictor {
std
::
unique_ptr
<
lite_api
::
Tensor
>
GetInput
(
int
i
)
override
;
std
::
unique_ptr
<
lite_api
::
Tensor
>
GetInput
(
int
i
)
override
;
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetOutput
(
int
i
)
const
override
;
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetOutput
(
int
i
)
const
override
;
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetOutput
(
const
std
::
string
&
name
)
const
override
;
void
Run
()
override
;
void
Run
()
override
;
...
...
lite/api/cxx_api_impl.cc
浏览文件 @
39ad0c74
...
@@ -46,6 +46,11 @@ std::unique_ptr<const lite_api::Tensor> CxxPaddleApiImpl::GetOutput(
...
@@ -46,6 +46,11 @@ std::unique_ptr<const lite_api::Tensor> CxxPaddleApiImpl::GetOutput(
return
std
::
unique_ptr
<
lite_api
::
Tensor
>
(
new
lite_api
::
Tensor
(
x
));
return
std
::
unique_ptr
<
lite_api
::
Tensor
>
(
new
lite_api
::
Tensor
(
x
));
}
}
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
CxxPaddleApiImpl
::
GetOutput
(
const
std
::
string
&
name
)
const
{
return
CxxPaddleApiImpl
::
GetTensor
(
name
);
}
std
::
vector
<
std
::
string
>
CxxPaddleApiImpl
::
GetInputNames
()
{
std
::
vector
<
std
::
string
>
CxxPaddleApiImpl
::
GetInputNames
()
{
return
raw_predictor_
.
GetInputNames
();
return
raw_predictor_
.
GetInputNames
();
}
}
...
...
lite/api/light_api.h
浏览文件 @
39ad0c74
...
@@ -57,6 +57,7 @@ class LITE_API LightPredictor {
...
@@ -57,6 +57,7 @@ class LITE_API LightPredictor {
Tensor
*
GetInputByName
(
const
std
::
string
&
name
);
Tensor
*
GetInputByName
(
const
std
::
string
&
name
);
// Get offset-th col of fetch outputs.
// Get offset-th col of fetch outputs.
const
Tensor
*
GetOutput
(
size_t
offset
);
const
Tensor
*
GetOutput
(
size_t
offset
);
const
Tensor
*
GetOutput
(
const
std
::
string
&
name
);
const
lite
::
Tensor
*
GetTensor
(
const
std
::
string
&
name
)
const
{
const
lite
::
Tensor
*
GetTensor
(
const
std
::
string
&
name
)
const
{
auto
*
var
=
program_
->
exec_scope
()
->
FindVar
(
name
);
auto
*
var
=
program_
->
exec_scope
()
->
FindVar
(
name
);
...
@@ -94,6 +95,9 @@ class LightPredictorImpl : public lite_api::PaddlePredictor {
...
@@ -94,6 +95,9 @@ class LightPredictorImpl : public lite_api::PaddlePredictor {
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetOutput
(
int
i
)
const
override
;
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetOutput
(
int
i
)
const
override
;
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
GetOutput
(
const
std
::
string
&
name
)
const
override
;
void
Run
()
override
;
void
Run
()
override
;
std
::
shared_ptr
<
lite_api
::
PaddlePredictor
>
Clone
()
override
;
std
::
shared_ptr
<
lite_api
::
PaddlePredictor
>
Clone
()
override
;
...
...
lite/api/light_api_impl.cc
浏览文件 @
39ad0c74
...
@@ -45,6 +45,11 @@ std::unique_ptr<const lite_api::Tensor> LightPredictorImpl::GetOutput(
...
@@ -45,6 +45,11 @@ std::unique_ptr<const lite_api::Tensor> LightPredictorImpl::GetOutput(
new
lite_api
::
Tensor
(
raw_predictor_
->
GetOutput
(
i
)));
new
lite_api
::
Tensor
(
raw_predictor_
->
GetOutput
(
i
)));
}
}
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
LightPredictorImpl
::
GetOutput
(
const
std
::
string
&
name
)
const
{
return
LightPredictorImpl
::
GetTensor
(
name
);
}
void
LightPredictorImpl
::
Run
()
{
void
LightPredictorImpl
::
Run
()
{
#ifdef LITE_WITH_ARM
#ifdef LITE_WITH_ARM
lite
::
DeviceInfo
::
Global
().
SetRunMode
(
mode_
,
threads_
);
lite
::
DeviceInfo
::
Global
().
SetRunMode
(
mode_
,
threads_
);
...
@@ -63,6 +68,7 @@ std::unique_ptr<const lite_api::Tensor> LightPredictorImpl::GetTensor(
...
@@ -63,6 +68,7 @@ std::unique_ptr<const lite_api::Tensor> LightPredictorImpl::GetTensor(
return
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
(
return
std
::
unique_ptr
<
const
lite_api
::
Tensor
>
(
new
lite_api
::
Tensor
(
raw_predictor_
->
GetTensor
(
name
)));
new
lite_api
::
Tensor
(
raw_predictor_
->
GetTensor
(
name
)));
}
}
std
::
unique_ptr
<
lite_api
::
Tensor
>
LightPredictorImpl
::
GetInputByName
(
std
::
unique_ptr
<
lite_api
::
Tensor
>
LightPredictorImpl
::
GetInputByName
(
const
std
::
string
&
name
)
{
const
std
::
string
&
name
)
{
return
std
::
unique_ptr
<
lite_api
::
Tensor
>
(
return
std
::
unique_ptr
<
lite_api
::
Tensor
>
(
...
...
lite/api/paddle_api.h
浏览文件 @
39ad0c74
...
@@ -77,6 +77,10 @@ class LITE_API PaddlePredictor {
...
@@ -77,6 +77,10 @@ class LITE_API PaddlePredictor {
/// Get i-th output.
/// Get i-th output.
virtual
std
::
unique_ptr
<
const
Tensor
>
GetOutput
(
int
i
)
const
=
0
;
virtual
std
::
unique_ptr
<
const
Tensor
>
GetOutput
(
int
i
)
const
=
0
;
/// Get output tensor with `name` existed.
virtual
std
::
unique_ptr
<
const
Tensor
>
GetOutput
(
const
std
::
string
&
name
)
const
=
0
;
virtual
void
Run
()
=
0
;
virtual
void
Run
()
=
0
;
virtual
std
::
shared_ptr
<
PaddlePredictor
>
Clone
()
=
0
;
virtual
std
::
shared_ptr
<
PaddlePredictor
>
Clone
()
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录