Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
bee0ff4b
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看板
提交
bee0ff4b
编写于
8月 09, 2018
作者:
Y
yangfei963158659
提交者:
GitHub
8月 09, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into develop
上级
0cee0cab
0e128b67
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
80 addition
and
21 deletion
+80
-21
src/operators/feed_op.h
src/operators/feed_op.h
+23
-3
src/operators/kernel/central-arm-func/box_coder_arm_func.h
src/operators/kernel/central-arm-func/box_coder_arm_func.h
+3
-1
src/operators/kernel/central-arm-func/conv_add_bn_relu_arm_func.h
...ators/kernel/central-arm-func/conv_add_bn_relu_arm_func.h
+3
-0
src/operators/kernel/central-arm-func/conv_add_relu_arm_func.h
...perators/kernel/central-arm-func/conv_add_relu_arm_func.h
+4
-0
src/operators/kernel/central-arm-func/conv_bn_relu_arm_func.h
...operators/kernel/central-arm-func/conv_bn_relu_arm_func.h
+3
-0
src/operators/kernel/central-arm-func/dwconv_bn_relu_arm_func.h
...erators/kernel/central-arm-func/dwconv_bn_relu_arm_func.h
+3
-0
src/operators/kernel/central-arm-func/elementwise_add_arm_func.h
...rators/kernel/central-arm-func/elementwise_add_arm_func.h
+2
-0
src/operators/kernel/central-arm-func/fusion_fc_arm_func.h
src/operators/kernel/central-arm-func/fusion_fc_arm_func.h
+2
-0
src/operators/kernel/central-arm-func/lrn_arm_func.h
src/operators/kernel/central-arm-func/lrn_arm_func.h
+1
-1
src/operators/kernel/central-arm-func/multiclass_nms_arm_func.h
...erators/kernel/central-arm-func/multiclass_nms_arm_func.h
+15
-10
src/operators/kernel/central-arm-func/relu_arm_func.h
src/operators/kernel/central-arm-func/relu_arm_func.h
+1
-0
src/operators/kernel/central-arm-func/reshape_arm_func.h
src/operators/kernel/central-arm-func/reshape_arm_func.h
+2
-0
src/operators/kernel/central-arm-func/softmax_arm_func.h
src/operators/kernel/central-arm-func/softmax_arm_func.h
+1
-0
src/operators/kernel/central-arm-func/transpose_arm_func.h
src/operators/kernel/central-arm-func/transpose_arm_func.h
+1
-0
src/operators/kernel/fpga/conv_add_bn_kernel.cpp
src/operators/kernel/fpga/conv_add_bn_kernel.cpp
+2
-2
src/operators/kernel/fpga/conv_add_bn_relu_kernel.cpp
src/operators/kernel/fpga/conv_add_bn_relu_kernel.cpp
+2
-2
src/operators/kernel/fpga/conv_add_relu_kernel.cpp
src/operators/kernel/fpga/conv_add_relu_kernel.cpp
+2
-2
src/operators/op_param.h
src/operators/op_param.h
+10
-0
未找到文件。
src/operators/feed_op.h
浏览文件 @
bee0ff4b
...
...
@@ -30,9 +30,6 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
:
framework
::
OperatorBase
<
DeviceType
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
scope
.
get
())
{}
void
RunImpl
()
const
{
param_
.
Out
()
->
ShareDataWith
(
*
param_
.
InputX
());
}
void
Init
()
{}
void
InferShape
()
const
{
auto
out_dims
=
param_
.
Out
()
->
dims
();
...
...
@@ -40,6 +37,29 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
param_
.
Out
()
->
Resize
(
out_dims
);
}
#ifdef PADDLE_MOBILE_FPGA
void
RunImpl
()
const
{
fpga
::
PerformBypass
(
param_
.
FpgaArgs
());
}
void
Init
()
{
const
Tensor
*
input
=
param_
.
InputX
();
auto
input_ptr
=
input
->
data
<
float
>
();
Tensor
*
output
=
param_
.
Out
();
auto
output_ptr
=
output
->
mutable_data
<
half
>
();
fpga
::
BypassArgs
args
;
args
.
convert_type
=
fpga
::
DATA_FP32_TO_FP16
;
args
.
layout_type
=
fpga
::
LAYOUT_CHW_TO_HWC
;
args
.
image
.
address
=
(
void
*
)
input_ptr
;
args
.
image
.
channels
=
input
->
dims
()[
1
];
args
.
image
.
height
=
input
->
dims
()[
2
];
args
.
image
.
width
=
input
->
dims
()[
3
];
args
.
output
.
address
=
output_ptr
;
param_
.
SetFpgaArgs
(
args
);
}
#else
void
RunImpl
()
const
{
param_
.
Out
()
->
ShareDataWith
(
*
param_
.
InputX
());
}
void
Init
()
{}
#endif
protected:
FeedParam
param_
;
};
...
...
src/operators/kernel/central-arm-func/box_coder_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -16,6 +16,8 @@ limitations under the License. */
#pragma once
#include <cmath>
#include "framework/tensor.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
@@ -122,7 +124,7 @@ void BoxCoderCompute(const BoxCoderParam& param) {
auto
col
=
input_priorbox
->
dims
()[
0
];
auto
len
=
input_priorbox
->
dims
()[
1
];
Tensor
*
output_box
=
param
.
OutputBox
();
framework
::
Tensor
*
output_box
=
param
.
OutputBox
();
auto
*
output_box_dataptr
=
output_box
->
mutable_data
<
float
>
({
row
,
col
,
len
});
if
(
code_type
==
"encode_center_size"
)
{
...
...
src/operators/kernel/central-arm-func/conv_add_bn_relu_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -18,6 +18,9 @@ limitations under the License. */
#include <vector>
#include "operators/math/depthwise_conv_3x3.h"
#include "operators/math/im2col.h"
#include "operators/math/math_function.h"
#include "operators/math/vol2col.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
...
...
src/operators/kernel/central-arm-func/conv_add_relu_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -16,6 +16,10 @@ limitations under the License. */
#pragma once
#include <vector>
#include "operators/math/conv_func.h"
#include "operators/math/im2col.h"
#include "operators/math/math_function.h"
#include "operators/math/vol2col.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
...
...
src/operators/kernel/central-arm-func/conv_bn_relu_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -17,6 +17,9 @@ limitations under the License. */
#pragma once
#include <vector>
#include "operators/math/depthwise_conv_3x3.h"
#include "operators/math/im2col.h"
#include "operators/math/math_function.h"
#include "operators/math/vol2col.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/dwconv_bn_relu_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -17,6 +17,9 @@ limitations under the License. */
#pragma once
#include <vector>
#include "operators/math/depthwise_conv_3x3.h"
#include "operators/math/im2col.h"
#include "operators/math/math_function.h"
#include "operators/math/vol2col.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/elementwise_add_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -15,6 +15,8 @@ limitations under the License. */
#ifdef ELEMENTWISEADD_OP
#pragma once
#include "operators/math/elementwise_op_function.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/fusion_fc_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -15,6 +15,8 @@ limitations under the License. */
#ifdef FUSION_FC_OP
#pragma once
#include "operators/math/math_function.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/lrn_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -15,7 +15,7 @@ limitations under the License. */
#ifdef LRN_OP
#pragma once
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/multiclass_nms_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -19,6 +19,8 @@ limitations under the License. */
#include <map>
#include <utility>
#include <vector>
#include "framework/tensor.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
@@ -89,7 +91,8 @@ static inline T JaccardOverlap(const T* box1, const T* box2,
}
template
<
typename
T
>
static
inline
void
NMSFast
(
const
Tensor
&
bbox
,
const
Tensor
&
scores
,
static
inline
void
NMSFast
(
const
framework
::
Tensor
&
bbox
,
const
framework
::
Tensor
&
scores
,
const
T
score_threshold
,
const
T
nms_threshold
,
const
T
eta
,
const
int64_t
top_k
,
std
::
vector
<
int
>*
selected_indices
)
{
...
...
@@ -131,7 +134,8 @@ static inline void NMSFast(const Tensor& bbox, const Tensor& scores,
}
template
<
typename
T
>
void
MultiClassNMS
(
const
Tensor
&
scores
,
const
Tensor
&
bboxes
,
void
MultiClassNMS
(
const
framework
::
Tensor
&
scores
,
const
framework
::
Tensor
&
bboxes
,
std
::
map
<
int
,
std
::
vector
<
int
>>*
indices
,
int
*
num_nmsed_out
,
const
int
&
background_label
,
const
int
&
nms_top_k
,
const
int
&
keep_top_k
,
const
T
&
nms_threshold
,
...
...
@@ -141,7 +145,7 @@ void MultiClassNMS(const Tensor& scores, const Tensor& bboxes,
int
num_det
=
0
;
for
(
int64_t
c
=
0
;
c
<
class_num
;
++
c
)
{
if
(
c
==
background_label
)
continue
;
Tensor
score
=
scores
.
Slice
(
c
,
c
+
1
);
framework
::
Tensor
score
=
scores
.
Slice
(
c
,
c
+
1
);
/// [c] is key
NMSFast
<
float
>
(
bboxes
,
score
,
score_threshold
,
nms_threshold
,
nms_eta
,
nms_top_k
,
&
((
*
indices
)[
c
]));
...
...
@@ -181,9 +185,10 @@ void MultiClassNMS(const Tensor& scores, const Tensor& bboxes,
}
template
<
typename
T
>
void
MultiClassOutput
(
const
Tensor
&
scores
,
const
Tensor
&
bboxes
,
void
MultiClassOutput
(
const
framework
::
Tensor
&
scores
,
const
framework
::
Tensor
&
bboxes
,
const
std
::
map
<
int
,
std
::
vector
<
int
>>&
selected_indices
,
Tensor
*
outs
)
{
framework
::
Tensor
*
outs
)
{
int
predict_dim
=
scores
.
dims
()[
1
];
auto
*
scores_data
=
scores
.
data
<
T
>
();
auto
*
bboxes_data
=
bboxes
.
data
<
T
>
();
...
...
@@ -231,10 +236,10 @@ void MultiClassNMSCompute(const MultiClassNMSParam& param) {
std
::
vector
<
std
::
map
<
int
,
std
::
vector
<
int
>>>
all_indices
;
std
::
vector
<
size_t
>
batch_starts
=
{
0
};
for
(
int64_t
i
=
0
;
i
<
batch_size
;
++
i
)
{
Tensor
ins_score
=
input_scores
->
Slice
(
i
,
i
+
1
);
framework
::
Tensor
ins_score
=
input_scores
->
Slice
(
i
,
i
+
1
);
ins_score
.
Resize
({
class_num
,
predict_dim
});
Tensor
ins_boxes
=
input_bboxes
->
Slice
(
i
,
i
+
1
);
framework
::
Tensor
ins_boxes
=
input_bboxes
->
Slice
(
i
,
i
+
1
);
ins_boxes
.
Resize
({
predict_dim
,
box_dim
});
std
::
map
<
int
,
std
::
vector
<
int
>>
indices
;
...
...
@@ -253,16 +258,16 @@ void MultiClassNMSCompute(const MultiClassNMSParam& param) {
}
else
{
outs
->
mutable_data
<
float
>
({
num_kept
,
kOutputDim
});
for
(
int64_t
i
=
0
;
i
<
batch_size
;
++
i
)
{
Tensor
ins_score
=
input_scores
->
Slice
(
i
,
i
+
1
);
framework
::
Tensor
ins_score
=
input_scores
->
Slice
(
i
,
i
+
1
);
ins_score
.
Resize
({
class_num
,
predict_dim
});
Tensor
ins_boxes
=
input_bboxes
->
Slice
(
i
,
i
+
1
);
framework
::
Tensor
ins_boxes
=
input_bboxes
->
Slice
(
i
,
i
+
1
);
ins_boxes
.
Resize
({
predict_dim
,
box_dim
});
int64_t
s
=
batch_starts
[
i
];
int64_t
e
=
batch_starts
[
i
+
1
];
if
(
e
>
s
)
{
Tensor
out
=
outs
->
Slice
(
s
,
e
);
framework
::
Tensor
out
=
outs
->
Slice
(
s
,
e
);
MultiClassOutput
<
float
>
(
ins_score
,
ins_boxes
,
all_indices
[
i
],
&
out
);
}
}
...
...
src/operators/kernel/central-arm-func/relu_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -16,6 +16,7 @@ limitations under the License. */
#pragma once
#include <operators/math/transform.h>
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/reshape_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -16,6 +16,8 @@ limitations under the License. */
#pragma once
#include <vector>
#include "operators/kernel/reshape_kernel.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/central-arm-func/softmax_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -15,6 +15,7 @@ limitations under the License. */
#ifdef SOFTMAX_OP
#pragma once
#include "../../math/softmax.h"
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
template
<
typename
P
>
...
...
src/operators/kernel/central-arm-func/transpose_arm_func.h
浏览文件 @
bee0ff4b
...
...
@@ -16,6 +16,7 @@ limitations under the License. */
#pragma once
#include <vector>
#include "operators/op_param.h"
namespace
paddle_mobile
{
namespace
operators
{
...
...
src/operators/kernel/fpga/conv_add_bn_kernel.cpp
浏览文件 @
bee0ff4b
...
...
@@ -24,13 +24,13 @@ template <>
bool
ConvAddBNKernel
<
FPGA
,
float
>::
Init
(
FusionConvAddBNParam
*
param
)
{
bool
relu_enabled
=
false
;
const
Tensor
*
input
=
param
->
Input
();
auto
input_ptr
=
input
->
data
<
float
>
();
auto
input_ptr
=
input
->
data
<
half
>
();
const
Tensor
*
bias
=
param
->
Bias
();
auto
bias_ptr
=
bias
->
data
<
float
>
();
const
Tensor
*
filter
=
param
->
Filter
();
auto
filter_ptr
=
filter
->
data
<
float
>
();
Tensor
*
out
=
param
->
Output
();
auto
out_ptr
=
out
->
mutable_data
<
float
>
();
auto
out_ptr
=
out
->
mutable_data
<
half
>
();
auto
bn_mean_ptr
=
param
->
InputMean
()
->
data
<
float
>
();
auto
bn_var_ptr
=
param
->
InputVariance
()
->
data
<
float
>
();
auto
bn_scale_ptr
=
param
->
InputScale
()
->
data
<
float
>
();
...
...
src/operators/kernel/fpga/conv_add_bn_relu_kernel.cpp
浏览文件 @
bee0ff4b
...
...
@@ -24,13 +24,13 @@ template <>
bool
ConvAddBNReluKernel
<
FPGA
,
float
>::
Init
(
FusionConvAddBNReluParam
*
param
)
{
bool
relu_enabled
=
true
;
const
Tensor
*
input
=
param
->
Input
();
auto
input_ptr
=
input
->
data
<
float
>
();
auto
input_ptr
=
input
->
data
<
half
>
();
const
Tensor
*
bias
=
param
->
Bias
();
auto
bias_ptr
=
bias
->
data
<
float
>
();
const
Tensor
*
filter
=
param
->
Filter
();
auto
filter_ptr
=
filter
->
data
<
float
>
();
Tensor
*
out
=
param
->
Output
();
auto
out_ptr
=
out
->
mutable_data
<
float
>
();
auto
out_ptr
=
out
->
mutable_data
<
half
>
();
auto
bn_mean_ptr
=
param
->
InputMean
()
->
data
<
float
>
();
auto
bn_var_ptr
=
param
->
InputVariance
()
->
data
<
float
>
();
auto
bn_scale_ptr
=
param
->
InputScale
()
->
data
<
float
>
();
...
...
src/operators/kernel/fpga/conv_add_relu_kernel.cpp
浏览文件 @
bee0ff4b
...
...
@@ -24,13 +24,13 @@ template <>
bool
ConvAddReluKernel
<
FPGA
,
float
>::
Init
(
FusionConvAddReluParam
*
param
)
{
bool
relu_enabled
=
true
;
const
Tensor
*
input
=
param
->
Input
();
auto
input_ptr
=
input
->
data
<
float
>
();
auto
input_ptr
=
input
->
data
<
half
>
();
const
Tensor
*
bias
=
param
->
Bias
();
auto
bias_ptr
=
bias
->
data
<
float
>
();
const
Tensor
*
filter
=
param
->
Filter
();
auto
filter_ptr
=
filter
->
data
<
float
>
();
Tensor
*
out
=
param
->
Output
();
auto
out_ptr
=
out
->
mutable_data
<
float
>
();
auto
out_ptr
=
out
->
mutable_data
<
half
>
();
PADDLE_MOBILE_ENFORCE
(
input
->
dims
()[
1
]
==
bias
->
dims
()[
0
],
"Image channel should be equal to bias number"
);
...
...
src/operators/op_param.h
浏览文件 @
bee0ff4b
...
...
@@ -665,6 +665,16 @@ class FeedParam : public OpParam {
Tensor
*
input_x_
;
Tensor
*
out_
;
int
batch_size
;
#ifdef PADDLE_MOBILE_FPGA
private:
fpga
::
BypassArgs
fpga_bypass_args
;
public:
const
fpga
::
BypassArgs
&
FpgaArgs
()
const
{
return
fpga_bypass_args
;
}
void
SetFpgaArgs
(
const
fpga
::
BypassArgs
&
args
)
{
fpga_bypass_args
=
args
;
}
#endif
};
class
FetchParam
:
public
OpParam
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录