Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
7fb9339a
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看板
未验证
提交
7fb9339a
编写于
6月 04, 2019
作者:
J
jameswu2014
提交者:
GitHub
6月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
concat+fetch bug for FPGA V1 track (#1678)
* marker1-anchor update * concat-fetch bug
上级
a10c01f7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
23 addition
and
4 deletion
+23
-4
src/fpga/V1/api.cpp
src/fpga/V1/api.cpp
+1
-0
src/framework/executor.cpp
src/framework/executor.cpp
+3
-3
src/io/api_paddle_mobile.cc
src/io/api_paddle_mobile.cc
+16
-0
src/operators/kernel/fpga/V1/relu_kernel.cpp
src/operators/kernel/fpga/V1/relu_kernel.cpp
+3
-1
未找到文件。
src/fpga/V1/api.cpp
浏览文件 @
7fb9339a
...
@@ -273,6 +273,7 @@ void format_concat_output(framework::Tensor *out, int height, int width,
...
@@ -273,6 +273,7 @@ void format_concat_output(framework::Tensor *out, int height, int width,
auto
ddim
=
framework
::
make_ddim
({
1
,
sum_channel
,
height
,
width
});
auto
ddim
=
framework
::
make_ddim
({
1
,
sum_channel
,
height
,
width
});
out
->
Resize
(
ddim
);
out
->
Resize
(
ddim
);
out
->
reset_data_ptr
(
data_ptr
);
out
->
reset_data_ptr
(
data_ptr
);
out
->
fpga_data_num
=
sum_cw
*
height
;
out
->
set_type
(
type_id
<
half
>
().
hash_code
());
out
->
set_type
(
type_id
<
half
>
().
hash_code
());
}
}
void
format_conv_data
(
framework
::
Tensor
*
filter_tensor
,
void
format_conv_data
(
framework
::
Tensor
*
filter_tensor
,
...
...
src/framework/executor.cpp
浏览文件 @
7fb9339a
...
@@ -561,9 +561,9 @@ template <typename Device, typename T>
...
@@ -561,9 +561,9 @@ template <typename Device, typename T>
void
Executor
<
Device
,
T
>::
FeedData
(
const
std
::
vector
<
void
*>
&
v
)
{
void
Executor
<
Device
,
T
>::
FeedData
(
const
std
::
vector
<
void
*>
&
v
)
{
auto
input_size
=
v
.
size
();
auto
input_size
=
v
.
size
();
int
index
=
0
;
int
index
=
0
;
auto
vars
=
program_
.
scope
->
VarContain
(
"feed"
,
&
index
);
//
auto vars = program_.scope->VarContain("feed", &index);
PADDLE_MOBILE_ENFORCE
(
input_size
==
vars
.
size
(),
//
PADDLE_MOBILE_ENFORCE(input_size == vars.size(),
"input data number not correct"
);
//
"input data number not correct");
for
(
int
i
=
0
;
i
<
input_size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
input_size
;
i
++
)
{
auto
var
=
program_
.
scope
->
Var
(
"feed"
,
i
+
index
);
auto
var
=
program_
.
scope
->
Var
(
"feed"
,
i
+
index
);
auto
feed_tensor
=
var
->
template
GetMutable
<
LoDTensor
>();
auto
feed_tensor
=
var
->
template
GetMutable
<
LoDTensor
>();
...
...
src/io/api_paddle_mobile.cc
浏览文件 @
7fb9339a
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
#include <vector>
#include <vector>
#include "common/enforce.h"
#include "common/enforce.h"
#include "framework/tensor.h"
#include "framework/tensor.h"
#ifdef PADDLE_MOBILE_FPGA
#include <fpga/common/fpga_common.h>
#endif
namespace
paddle_mobile
{
namespace
paddle_mobile
{
...
@@ -179,6 +182,19 @@ void PaddleMobilePredictor<Device, T>::FetchPaddleTensors(PaddleTensor *output,
...
@@ -179,6 +182,19 @@ void PaddleMobilePredictor<Device, T>::FetchPaddleTensors(PaddleTensor *output,
int
id
)
{
int
id
)
{
std
::
shared_ptr
<
framework
::
Tensor
>
tensor_ptr
=
std
::
shared_ptr
<
framework
::
Tensor
>
tensor_ptr
=
paddle_mobile_
->
FetchResult
(
id
);
paddle_mobile_
->
FetchResult
(
id
);
void
*
data_addr
=
nullptr
;
int
data_sizeof
=
1
;
if
(
tensor_ptr
.
get
()
->
type
()
==
type_id
<
half
>
().
hash_code
())
{
data_addr
=
tensor_ptr
.
get
()
->
data
<
half
>
();
data_sizeof
=
sizeof
(
half
);
}
else
if
(
tensor_ptr
.
get
()
->
type
()
==
type_id
<
float
>
().
hash_code
())
{
data_addr
=
tensor_ptr
.
get
()
->
data
<
float
>
();
data_sizeof
=
sizeof
(
float
);
}
else
{
PADDLE_MOBILE_ENFORCE
(
0
,
"output typeid is not supported"
);
}
size_t
size
=
tensor_ptr
.
get
()
->
numel
()
*
data_sizeof
;
fpga
::
fpga_invalidate
(
data_addr
,
size
);
ConvertTensors
(
*
(
tensor_ptr
.
get
()),
output
);
ConvertTensors
(
*
(
tensor_ptr
.
get
()),
output
);
return
;
return
;
}
}
...
...
src/operators/kernel/fpga/V1/relu_kernel.cpp
浏览文件 @
7fb9339a
...
@@ -26,7 +26,9 @@ bool ReluKernel<FPGA, float>::Init(ReluParam<FPGA> *param) {
...
@@ -26,7 +26,9 @@ bool ReluKernel<FPGA, float>::Init(ReluParam<FPGA> *param) {
}
}
template
<
>
template
<
>
void
ReluKernel
<
FPGA
,
float
>::
Compute
(
const
ReluParam
<
FPGA
>
&
param
)
{}
void
ReluKernel
<
FPGA
,
float
>::
Compute
(
const
ReluParam
<
FPGA
>
&
param
)
{
PADDLE_MOBILE_ENFORCE
(
0
,
"relu as a single op is wrong"
);
}
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录