Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
048cb9a7
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
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看板
提交
048cb9a7
编写于
4月 19, 2019
作者:
qnqinan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update some files in FPGA V2
上级
7d999238
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
33 addition
and
14 deletion
+33
-14
src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp
src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp
+7
-2
src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp
src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp
+7
-3
src/operators/kernel/fpga/V2/conv_add_kernel.cpp
src/operators/kernel/fpga/V2/conv_add_kernel.cpp
+7
-2
src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp
src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp
+7
-2
src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp
src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp
+1
-1
src/operators/kernel/fpga/V2/psroi_pool_kernel.cpp
src/operators/kernel/fpga/V2/psroi_pool_kernel.cpp
+2
-2
src/operators/kernel/fpga/V2/roialign_pool_kernel.cpp
src/operators/kernel/fpga/V2/roialign_pool_kernel.cpp
+2
-2
未找到文件。
src/operators/kernel/fpga/V2/conv_add_bn_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -33,6 +33,9 @@ bool ConvAddBNKernel<FPGA, float>::Init(FusionConvAddBNParam<FPGA> *param) {
auto
filter
=
const_cast
<
LoDTensor
*>
(
param
->
Filter
());
auto
out
=
param
->
Output
();
float
Si
=
input
->
scale
[
0
];
float
So
=
out
->
scale
[
0
];
float
Sf
=
fpga
::
filter_find_max
(
filter
);
auto
bn_mean_ptr
=
param
->
InputMean
()
->
data
<
float
>
();
auto
bn_var_ptr
=
param
->
InputVariance
()
->
data
<
float
>
();
...
...
@@ -56,8 +59,10 @@ bool ConvAddBNKernel<FPGA, float>::Init(FusionConvAddBNParam<FPGA> *param) {
static_cast
<
float
>
(
pow
((
bn_var_ptr
[
i
]
+
epsilon
),
0.5
));
new_bias_ptr
[
i
]
=
bn_bias_ptr
[
i
]
+
(
bias_ptr
[
i
]
-
bn_mean_ptr
[
i
])
*
new_scale_ptr
[
i
];
bs_ptr
[
i
+
channel
]
=
new_scale_ptr
[
i
];
bs_ptr
[
i
]
=
new_bias_ptr
[
i
];
// bs_ptr[i + channel] = new_scale_ptr[i];
// bs_ptr[i] = new_bias_ptr[i];
bs_ptr
[
i
+
channel
]
=
new_scale_ptr
[
i
]
*
Si
/
So
*
Sf
/
127.0
;
bs_ptr
[
i
]
=
new_bias_ptr
[
i
]
*
127.0
/
So
;
}
fpga
::
format_conv_data
(
filter
,
out
,
&
bs_ptr
,
param
->
Groups
());
...
...
src/operators/kernel/fpga/V2/conv_add_bn_relu_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -32,7 +32,9 @@ bool ConvAddBNReluKernel<FPGA, float>::Init(
auto
bias_ptr
=
bias
->
data
<
float
>
();
auto
filter
=
const_cast
<
LoDTensor
*>
(
param
->
Filter
());
auto
out
=
param
->
Output
();
float
Si
=
input
->
scale
[
0
];
float
So
=
out
->
scale
[
0
];
float
Sf
=
fpga
::
filter_find_max
(
filter
);
vector
<
int
>
paddings
=
param
->
Paddings
();
vector
<
int
>
strides
=
param
->
Strides
();
auto
bn_mean_ptr
=
param
->
InputMean
()
->
data
<
float
>
();
...
...
@@ -57,8 +59,10 @@ bool ConvAddBNReluKernel<FPGA, float>::Init(
static_cast
<
float
>
(
pow
((
bn_var_ptr
[
i
]
+
epsilon
),
0.5
));
new_bias_ptr
[
i
]
=
bn_bias_ptr
[
i
]
+
(
bias_ptr
[
i
]
-
bn_mean_ptr
[
i
])
*
new_scale_ptr
[
i
];
bs_ptr
[
i
+
channel
]
=
new_scale_ptr
[
i
];
bs_ptr
[
i
]
=
new_bias_ptr
[
i
];
// bs_ptr[i + channel] = new_scale_ptr[i];
// bs_ptr[i] = new_bias_ptr[i];
bs_ptr
[
i
+
channel
]
=
new_scale_ptr
[
i
]
*
Si
/
So
*
Sf
/
127.0
;
bs_ptr
[
i
]
=
new_bias_ptr
[
i
]
*
127.0
/
So
;
}
const
int
groups
=
param
->
Groups
();
...
...
src/operators/kernel/fpga/V2/conv_add_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -30,6 +30,9 @@ bool ConvAddKernel<FPGA, float>::Init(FusionConvAddParam<FPGA> *param) {
auto
bias_ptr
=
bias
->
data
<
float
>
();
auto
filter
=
const_cast
<
LoDTensor
*>
(
param
->
Filter
());
auto
out
=
param
->
Output
();
float
Si
=
input
->
scale
[
0
];
float
So
=
out
->
scale
[
0
];
float
Sf
=
fpga
::
filter_find_max
(
filter
);
PADDLE_MOBILE_ENFORCE
(
out
->
dims
()[
1
]
==
bias
->
dims
()[
0
],
"Output channel should be equal to bias number"
);
...
...
@@ -37,8 +40,10 @@ bool ConvAddKernel<FPGA, float>::Init(FusionConvAddParam<FPGA> *param) {
auto
bs_ptr
=
(
float
*
)
fpga
::
fpga_malloc
(
2
*
channel
*
sizeof
(
float
));
// NOLINT
for
(
int
i
=
0
;
i
<
channel
;
i
++
)
{
bs_ptr
[
i
+
channel
]
=
1
;
bs_ptr
[
i
]
=
bias_ptr
[
i
];
// bs_ptr[i + channel] = 1;
// bs_ptr[i] = bias_ptr[i];
bs_ptr
[
i
+
channel
]
=
Si
/
So
*
Sf
/
127.0
;
bs_ptr
[
i
]
=
bias_ptr
[
i
]
*
127.0
/
So
;
}
fpga
::
format_conv_data
(
filter
,
out
,
&
bs_ptr
,
param
->
Groups
());
...
...
src/operators/kernel/fpga/V2/conv_add_relu_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -30,6 +30,9 @@ bool ConvAddReluKernel<FPGA, float>::Init(FusionConvAddReluParam<FPGA> *param) {
auto
bias_ptr
=
bias
->
data
<
float
>
();
auto
filter
=
const_cast
<
LoDTensor
*>
(
param
->
Filter
());
auto
out
=
param
->
Output
();
float
Si
=
input
->
scale
[
0
];
float
So
=
out
->
scale
[
0
];
float
Sf
=
fpga
::
filter_find_max
(
filter
);
PADDLE_MOBILE_ENFORCE
(
out
->
dims
()[
1
]
==
bias
->
dims
()[
0
],
"Output channel should be equal to bias number"
);
...
...
@@ -37,8 +40,10 @@ bool ConvAddReluKernel<FPGA, float>::Init(FusionConvAddReluParam<FPGA> *param) {
auto
bs_ptr
=
(
float
*
)
fpga
::
fpga_malloc
(
2
*
channel
*
sizeof
(
float
));
// NOLINT
for
(
int
i
=
0
;
i
<
channel
;
i
++
)
{
bs_ptr
[
i
+
channel
]
=
1
;
bs_ptr
[
i
]
=
bias_ptr
[
i
];
// bs_ptr[i + channel] = 1;
// bs_ptr[i] = bias_ptr[i];
bs_ptr
[
i
+
channel
]
=
Si
/
So
*
Sf
/
127.0
;
bs_ptr
[
i
]
=
bias_ptr
[
i
]
*
127.0
/
So
;
}
fpga
::
format_conv_data
(
filter
,
out
,
&
bs_ptr
,
param
->
Groups
());
...
...
src/operators/kernel/fpga/V2/elementwise_add_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -16,7 +16,7 @@ limitations under the License. */
#include "operators/kernel/elementwise_add_kernel.h"
#include <string>
#include "fpga/V
1
/api.h"
#include "fpga/V
2
/api.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/fpga/V2/psroi_pool_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -18,8 +18,8 @@ limitations under the License. */
#include <vector>
#include "operators/kernel/detection_kernel.h"
#include "fpga/V
1
/api.h"
#include "fpga/V
1
/image.h"
#include "fpga/V
2
/api.h"
#include "fpga/V
2
/image.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/fpga/V2/roialign_pool_kernel.cpp
浏览文件 @
048cb9a7
...
...
@@ -18,8 +18,8 @@ limitations under the License. */
#include <vector>
#include "operators/kernel/detection_kernel.h"
#include "fpga/V
1
/api.h"
#include "fpga/V
1
/image.h"
#include "fpga/V
2
/api.h"
#include "fpga/V
2
/image.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录