Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
041a31a2
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看板
提交
041a31a2
编写于
9月 15, 2018
作者:
Z
zhangyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add InjectVariable function for FPGA track
上级
17408811
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
21 addition
and
3 deletion
+21
-3
src/io/executor.cpp
src/io/executor.cpp
+9
-2
src/io/executor.h
src/io/executor.h
+3
-0
src/io/paddle_mobile.cpp
src/io/paddle_mobile.cpp
+8
-1
src/io/paddle_mobile.h
src/io/paddle_mobile.h
+1
-0
未找到文件。
src/io/executor.cpp
浏览文件 @
041a31a2
...
@@ -645,15 +645,22 @@ std::vector<typename Executor<Dtype, P>::Ptype> Executor<Dtype, P>::Predict(
...
@@ -645,15 +645,22 @@ std::vector<typename Executor<Dtype, P>::Ptype> Executor<Dtype, P>::Predict(
}
}
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
template
<
typename
Dtype
,
Precision
P
>
template
<
typename
Dtype
,
Precision
P
>
void
Executor
<
Dtype
,
P
>::
FeedData
(
const
framework
::
Tensor
&
t
)
{
void
Executor
<
Dtype
,
P
>::
InjectVariable
(
const
framework
::
Tensor
&
t
,
framework
::
Variable
*
g_feed_value
=
program_
.
scope
->
Var
(
"feed"
);
string
var_name
)
{
framework
::
Variable
*
g_feed_value
=
program_
.
scope
->
Var
(
var_name
);
framework
::
Tensor
*
feed_tensor
=
framework
::
Tensor
*
feed_tensor
=
g_feed_value
->
GetMutable
<
framework
::
LoDTensor
>
();
g_feed_value
->
GetMutable
<
framework
::
LoDTensor
>
();
feed_tensor
->
Resize
(
t
.
dims
());
feed_tensor
->
Resize
(
t
.
dims
());
feed_tensor
->
ShareDataWith
(
t
);
feed_tensor
->
ShareDataWith
(
t
);
};
};
template
<
typename
Dtype
,
Precision
P
>
void
Executor
<
Dtype
,
P
>::
FeedData
(
const
framework
::
Tensor
&
t
)
{
InjectVariable
(
t
,
"feed"
);
};
template
<
typename
Dtype
,
Precision
P
>
template
<
typename
Dtype
,
Precision
P
>
std
::
shared_ptr
<
framework
::
Tensor
>
Executor
<
Dtype
,
P
>::
FetchResult
()
{
std
::
shared_ptr
<
framework
::
Tensor
>
Executor
<
Dtype
,
P
>::
FetchResult
()
{
std
::
shared_ptr
<
framework
::
BlockDesc
>
to_predict_block
=
std
::
shared_ptr
<
framework
::
BlockDesc
>
to_predict_block
=
...
...
src/io/executor.h
浏览文件 @
041a31a2
...
@@ -30,6 +30,7 @@ limitations under the License. */
...
@@ -30,6 +30,7 @@ limitations under the License. */
#include <thread>
#include <thread>
#include "common/dep_core.h"
#include "common/dep_core.h"
#endif
#endif
using
std
::
string
;
namespace
paddle_mobile
{
namespace
paddle_mobile
{
...
@@ -94,7 +95,9 @@ class Executor {
...
@@ -94,7 +95,9 @@ class Executor {
framework
::
LoDTensor
*
tensor
)
const
;
framework
::
LoDTensor
*
tensor
)
const
;
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
public:
public:
void
InjectVariable
(
const
framework
::
Tensor
&
t
,
string
var_name
);
void
FeedData
(
const
framework
::
Tensor
&
t
);
void
FeedData
(
const
framework
::
Tensor
&
t
);
std
::
shared_ptr
<
framework
::
Tensor
>
FetchResult
();
std
::
shared_ptr
<
framework
::
Tensor
>
FetchResult
();
void
Predict_From_To
(
int
start
=
0
,
int
end
=
-
1
);
void
Predict_From_To
(
int
start
=
0
,
int
end
=
-
1
);
...
...
src/io/paddle_mobile.cpp
浏览文件 @
041a31a2
...
@@ -125,9 +125,16 @@ PaddleMobile<Dtype, P>::~PaddleMobile() {
...
@@ -125,9 +125,16 @@ PaddleMobile<Dtype, P>::~PaddleMobile() {
}
}
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
template
<
typename
Dtype
,
Precision
P
>
void
PaddleMobile
<
Dtype
,
P
>::
InjectVariable
(
const
framework
::
Tensor
&
t
,
string
var_name
)
{
executor_
->
InjectVariable
(
t
,
var_name
);
}
template
<
typename
Dtype
,
Precision
P
>
template
<
typename
Dtype
,
Precision
P
>
void
PaddleMobile
<
Dtype
,
P
>::
FeedData
(
const
framework
::
Tensor
&
t
)
{
void
PaddleMobile
<
Dtype
,
P
>::
FeedData
(
const
framework
::
Tensor
&
t
)
{
return
executor_
->
FeedData
(
t
);
executor_
->
FeedData
(
t
);
};
};
template
<
typename
Dtype
,
Precision
P
>
template
<
typename
Dtype
,
Precision
P
>
...
...
src/io/paddle_mobile.h
浏览文件 @
041a31a2
...
@@ -95,6 +95,7 @@ class PaddleMobile {
...
@@ -95,6 +95,7 @@ class PaddleMobile {
#ifdef PADDLE_MOBILE_FPGA
#ifdef PADDLE_MOBILE_FPGA
public:
public:
void
InjectVariable
(
const
framework
::
Tensor
&
t
,
string
var_name
);
void
FeedData
(
const
framework
::
Tensor
&
t
);
void
FeedData
(
const
framework
::
Tensor
&
t
);
std
::
shared_ptr
<
framework
::
Tensor
>
FetchResult
();
std
::
shared_ptr
<
framework
::
Tensor
>
FetchResult
();
void
Predict_From_To
(
int
start
=
0
,
int
end
=
-
1
);
void
Predict_From_To
(
int
start
=
0
,
int
end
=
-
1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录