Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
de60e255
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看板
提交
de60e255
编写于
3月 21, 2019
作者:
qnqinan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
a7cd737f
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
22 addition
and
21 deletion
+22
-21
src/operators/kernel/fpga/V1/fetch_kernel.cpp
src/operators/kernel/fpga/V1/fetch_kernel.cpp
+22
-21
未找到文件。
src/operators/kernel/fpga/V1/fetch_kernel.cpp
浏览文件 @
de60e255
...
@@ -30,19 +30,20 @@ bool FetchKernel<FPGA, float>::Init(FetchParam<FPGA> *param) {
...
@@ -30,19 +30,20 @@ bool FetchKernel<FPGA, float>::Init(FetchParam<FPGA> *param) {
int
outC
=
1
;
int
outC
=
1
;
int
outH
=
1
;
int
outH
=
1
;
int
outW
=
1
;
int
outW
=
1
;
if
(
output
->
dims
().
size
()
==
4
)
{
if
(
output
->
dims
().
size
()
==
4
)
{
outC
=
output
->
dims
()[
1
];
outC
=
output
->
dims
()[
1
];
outH
=
output
->
dims
()[
2
];
outH
=
output
->
dims
()[
2
];
outW
=
output
->
dims
()[
3
];
outW
=
output
->
dims
()[
3
];
}
else
{
//
2
}
else
{
//
2
outC
=
output
->
dims
()[
1
];
outC
=
output
->
dims
()[
1
];
}
}
int
unalignedCW
=
outC
*
outW
;
int
unalignedCW
=
outC
*
outW
;
int
alignedCW
=
fpga
::
align_to_x
(
unalignedCW
,
IMAGE_ALIGNMENT
);
int
alignedCW
=
fpga
::
align_to_x
(
unalignedCW
,
IMAGE_ALIGNMENT
);
if
(
alignedCW
!=
unalignedCW
)
{
if
(
alignedCW
!=
unalignedCW
)
{
param
->
aligned_out
.
Resize
(
input
->
dims
());
param
->
aligned_out
.
Resize
(
input
->
dims
());
param
->
aligned_out
.
mutable_data
<
float
>
(
input
->
dims
());
param
->
aligned_out
.
mutable_data
<
float
>
(
input
->
dims
());
fpga
::
fpga_flush
(
param
->
aligned_out
.
data
<
float
>
(),
outH
*
unalignedCW
*
sizeof
(
float
));
fpga
::
fpga_flush
(
param
->
aligned_out
.
data
<
float
>
(),
outH
*
unalignedCW
*
sizeof
(
float
));
}
}
fpga
::
BypassArgs
args
=
{
fpga
::
DATA_TYPE_FP16
};
fpga
::
BypassArgs
args
=
{
fpga
::
DATA_TYPE_FP16
};
...
@@ -101,11 +102,11 @@ void FetchKernel<FPGA, float>::Compute(const FetchParam<FPGA> ¶m) {
...
@@ -101,11 +102,11 @@ void FetchKernel<FPGA, float>::Compute(const FetchParam<FPGA> ¶m) {
int
outC
=
1
;
int
outC
=
1
;
int
outH
=
1
;
int
outH
=
1
;
int
outW
=
1
;
int
outW
=
1
;
if
(
output
->
dims
().
size
()
==
4
)
{
if
(
output
->
dims
().
size
()
==
4
)
{
outC
=
output
->
dims
()[
1
];
outC
=
output
->
dims
()[
1
];
outH
=
output
->
dims
()[
2
];
outH
=
output
->
dims
()[
2
];
outW
=
output
->
dims
()[
3
];
outW
=
output
->
dims
()[
3
];
}
else
{
//
2
}
else
{
//
2
outC
=
output
->
dims
()[
1
];
outC
=
output
->
dims
()[
1
];
}
}
...
@@ -113,8 +114,8 @@ void FetchKernel<FPGA, float>::Compute(const FetchParam<FPGA> ¶m) {
...
@@ -113,8 +114,8 @@ void FetchKernel<FPGA, float>::Compute(const FetchParam<FPGA> ¶m) {
output
->
fpga_data_num
*
sizeof
(
float
));
output
->
fpga_data_num
*
sizeof
(
float
));
int
unalignedCW
=
outC
*
outW
;
int
unalignedCW
=
outC
*
outW
;
int
alignedCW
=
fpga
::
align_to_x
(
unalignedCW
,
IMAGE_ALIGNMENT
);
int
alignedCW
=
fpga
::
align_to_x
(
unalignedCW
,
IMAGE_ALIGNMENT
);
if
(
unalignedCW
!=
alignedCW
)
{
if
(
unalignedCW
!=
alignedCW
)
{
auto
aligned_ptr
=
const_cast
<
float
*>
(
param
.
aligned_out
.
data
<
float
>
());
auto
aligned_ptr
=
const_cast
<
float
*>
(
param
.
aligned_out
.
data
<
float
>
());
dealign
(
outdata_ptr
,
aligned_ptr
,
outC
,
outH
,
outW
);
dealign
(
outdata_ptr
,
aligned_ptr
,
outC
,
outH
,
outW
);
memcpy
(
outdata_ptr
,
aligned_ptr
,
outC
*
outH
*
outW
*
sizeof
(
float
));
memcpy
(
outdata_ptr
,
aligned_ptr
,
outC
*
outH
*
outW
*
sizeof
(
float
));
fpga
::
fpga_flush
(
outdata_ptr
,
outC
*
outH
*
outW
*
sizeof
(
float
));
fpga
::
fpga_flush
(
outdata_ptr
,
outC
*
outH
*
outW
*
sizeof
(
float
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录