Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
136c9f32
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看板
提交
136c9f32
编写于
6月 27, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add kernel init method
上级
6543b2a5
变更
45
隐藏空白更改
内联
并排
Showing
45 changed file
with
149 addition
and
2 deletion
+149
-2
src/framework/operator.h
src/framework/operator.h
+7
-2
src/io/io.cpp
src/io/io.cpp
+9
-0
src/operators/feed_op.h
src/operators/feed_op.h
+2
-0
src/operators/fetch_op.h
src/operators/fetch_op.h
+2
-0
src/operators/kernel/arm/batchnorm_kernel.cpp
src/operators/kernel/arm/batchnorm_kernel.cpp
+5
-0
src/operators/kernel/arm/box_coder_kernel.cpp
src/operators/kernel/arm/box_coder_kernel.cpp
+5
-0
src/operators/kernel/arm/concat_kernel.cpp
src/operators/kernel/arm/concat_kernel.cpp
+5
-0
src/operators/kernel/arm/conv_add_kernel.cpp
src/operators/kernel/arm/conv_add_kernel.cpp
+5
-0
src/operators/kernel/arm/conv_add_relu_kernel.cpp
src/operators/kernel/arm/conv_add_relu_kernel.cpp
+5
-0
src/operators/kernel/arm/conv_kernel.cpp
src/operators/kernel/arm/conv_kernel.cpp
+5
-0
src/operators/kernel/arm/depthwise_conv_kernel.cpp
src/operators/kernel/arm/depthwise_conv_kernel.cpp
+5
-0
src/operators/kernel/arm/elementwise_add_kernel.cpp
src/operators/kernel/arm/elementwise_add_kernel.cpp
+5
-0
src/operators/kernel/arm/fusion_fc_kernel.cpp
src/operators/kernel/arm/fusion_fc_kernel.cpp
+5
-0
src/operators/kernel/arm/lrn_kernel.cpp
src/operators/kernel/arm/lrn_kernel.cpp
+5
-0
src/operators/kernel/arm/mul_kernel.cpp
src/operators/kernel/arm/mul_kernel.cpp
+5
-0
src/operators/kernel/arm/multiclass_nms_kernel.cpp
src/operators/kernel/arm/multiclass_nms_kernel.cpp
+5
-0
src/operators/kernel/arm/pool_kernel.cpp
src/operators/kernel/arm/pool_kernel.cpp
+5
-0
src/operators/kernel/arm/prior_box_kernel.cpp
src/operators/kernel/arm/prior_box_kernel.cpp
+5
-0
src/operators/kernel/arm/relu_kernel.cpp
src/operators/kernel/arm/relu_kernel.cpp
+5
-0
src/operators/kernel/arm/reshape_kernel.cpp
src/operators/kernel/arm/reshape_kernel.cpp
+5
-0
src/operators/kernel/arm/sigmoid_kernel.cpp
src/operators/kernel/arm/sigmoid_kernel.cpp
+5
-0
src/operators/kernel/arm/softmax_kernel.cpp
src/operators/kernel/arm/softmax_kernel.cpp
+5
-0
src/operators/kernel/arm/transpose_kernel.cpp
src/operators/kernel/arm/transpose_kernel.cpp
+5
-0
src/operators/kernel/batchnorm_kernel.h
src/operators/kernel/batchnorm_kernel.h
+1
-0
src/operators/kernel/box_coder_kernel.h
src/operators/kernel/box_coder_kernel.h
+1
-0
src/operators/kernel/concat_kernel.h
src/operators/kernel/concat_kernel.h
+1
-0
src/operators/kernel/conv_add_kernel.h
src/operators/kernel/conv_add_kernel.h
+1
-0
src/operators/kernel/conv_add_relu_kernel.h
src/operators/kernel/conv_add_relu_kernel.h
+1
-0
src/operators/kernel/conv_kernel.h
src/operators/kernel/conv_kernel.h
+1
-0
src/operators/kernel/depthwise_conv_kernel.h
src/operators/kernel/depthwise_conv_kernel.h
+1
-0
src/operators/kernel/elementwise_add_kernel.h
src/operators/kernel/elementwise_add_kernel.h
+1
-0
src/operators/kernel/fpga/conv_kernel.cpp
src/operators/kernel/fpga/conv_kernel.cpp
+5
-0
src/operators/kernel/fusion_fc_kernel.h
src/operators/kernel/fusion_fc_kernel.h
+1
-0
src/operators/kernel/lrn_kernel.h
src/operators/kernel/lrn_kernel.h
+1
-0
src/operators/kernel/mali/batchnorm_kernel.cpp
src/operators/kernel/mali/batchnorm_kernel.cpp
+5
-0
src/operators/kernel/mali/conv_kernel.cpp
src/operators/kernel/mali/conv_kernel.cpp
+5
-0
src/operators/kernel/mul_kernel.h
src/operators/kernel/mul_kernel.h
+1
-0
src/operators/kernel/multiclass_nms_kernel.h
src/operators/kernel/multiclass_nms_kernel.h
+1
-0
src/operators/kernel/pool_kernel.h
src/operators/kernel/pool_kernel.h
+1
-0
src/operators/kernel/prior_box_kernel.h
src/operators/kernel/prior_box_kernel.h
+1
-0
src/operators/kernel/relu_kernel.h
src/operators/kernel/relu_kernel.h
+1
-0
src/operators/kernel/reshape_kernel.h
src/operators/kernel/reshape_kernel.h
+1
-0
src/operators/kernel/sigmoid_kernel.h
src/operators/kernel/sigmoid_kernel.h
+1
-0
src/operators/kernel/softmax_kernel.h
src/operators/kernel/softmax_kernel.h
+1
-0
src/operators/kernel/transpose_kernel.h
src/operators/kernel/transpose_kernel.h
+1
-0
未找到文件。
src/framework/operator.h
浏览文件 @
136c9f32
...
@@ -63,6 +63,7 @@ class OperatorBase {
...
@@ -63,6 +63,7 @@ class OperatorBase {
std
::
vector
<
string
>
GetOutKeys
()
const
;
std
::
vector
<
string
>
GetOutKeys
()
const
;
virtual
void
RunImpl
()
const
=
0
;
virtual
void
RunImpl
()
const
=
0
;
virtual
void
Init
()
const
=
0
;
/*
/*
* @b op 运算所需的输入, 如上一层的输出结果、卷积核
* @b op 运算所需的输入, 如上一层的输出结果、卷积核
* */
* */
...
@@ -111,14 +112,18 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
...
@@ -111,14 +112,18 @@ class OperatorWithKernel : public OperatorBase<Dtype> {
std
::
shared_ptr
<
Scope
>
scope
)
std
::
shared_ptr
<
Scope
>
scope
)
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
:
OperatorBase
<
Dtype
>
(
type
,
inputs
,
outputs
,
attrs
,
scope
),
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{
PADDLE_MOBILE_ENFORCE
(
kernel_
.
Init
(
param_
),
" %s kernel init failed"
,
this
->
type_
.
c_str
());
}
}
virtual
void
RunImpl
()
const
{
this
->
kernel_
.
Compute
(
this
->
param_
);
}
virtual
void
RunImpl
()
const
{
this
->
kernel_
.
Compute
(
this
->
param_
);
}
virtual
void
InferShape
()
const
=
0
;
virtual
void
InferShape
()
const
=
0
;
void
Init
()
const
{
PADDLE_MOBILE_ENFORCE
(
kernel_
.
Init
(
param_
),
" %s kernel init failed"
,
this
->
type_
.
c_str
());
}
protected:
protected:
KernelType
kernel_
;
KernelType
kernel_
;
ParamType
param_
;
ParamType
param_
;
...
...
src/io/io.cpp
浏览文件 @
136c9f32
...
@@ -198,6 +198,13 @@ Executor<Dtype, P>::Executor(const framework::Program<Dtype> p, int batch_size,
...
@@ -198,6 +198,13 @@ Executor<Dtype, P>::Executor(const framework::Program<Dtype> p, int batch_size,
}
else
{
}
else
{
InitMemory
();
InitMemory
();
}
}
std
::
shared_ptr
<
framework
::
BlockDesc
>
to_predict_block
=
to_predict_program_
->
Block
(
0
);
auto
&
ops
=
ops_of_block_
[
*
to_predict_block
.
get
()];
for
(
const
auto
&
op
:
ops
)
{
op
->
Init
();
}
}
}
template
<
typename
Dtype
,
Precision
P
>
template
<
typename
Dtype
,
Precision
P
>
...
@@ -416,6 +423,8 @@ std::shared_ptr<framework::Tensor> Executor<Dtype, P>::Predict(
...
@@ -416,6 +423,8 @@ std::shared_ptr<framework::Tensor> Executor<Dtype, P>::Predict(
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
profile
[
i
].
runBegin
=
(
uint64_t
)
ts
.
tv_sec
*
1e9
+
ts
.
tv_nsec
;
profile
[
i
].
runBegin
=
(
uint64_t
)
ts
.
tv_sec
*
1e9
+
ts
.
tv_nsec
;
#endif
#endif
// to Run
ops
[
i
]
->
Run
();
ops
[
i
]
->
Run
();
#ifdef PADDLE_MOBILE_PROFILE
#ifdef PADDLE_MOBILE_PROFILE
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
ts
);
...
...
src/operators/feed_op.h
浏览文件 @
136c9f32
...
@@ -32,6 +32,8 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
...
@@ -32,6 +32,8 @@ class FeedOp : public framework::OperatorBase<DeviceType> {
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
void
RunImpl
()
const
{
param_
.
Out
()
->
ShareDataWith
(
*
param_
.
InputX
());
}
void
RunImpl
()
const
{
param_
.
Out
()
->
ShareDataWith
(
*
param_
.
InputX
());
}
void
Init
()
const
{}
void
InferShape
()
const
{
void
InferShape
()
const
{
auto
out_dims
=
param_
.
Out
()
->
dims
();
auto
out_dims
=
param_
.
Out
()
->
dims
();
out_dims
[
0
]
=
param_
.
BatchSize
();
out_dims
[
0
]
=
param_
.
BatchSize
();
...
...
src/operators/fetch_op.h
浏览文件 @
136c9f32
...
@@ -33,6 +33,8 @@ class FetchOp : public framework::OperatorBase<DeviceType> {
...
@@ -33,6 +33,8 @@ class FetchOp : public framework::OperatorBase<DeviceType> {
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
param_
(
inputs
,
outputs
,
attrs
,
*
scope
)
{}
void
RunImpl
()
const
{
param_
.
Out
()
->
ShareDataWith
(
*
param_
.
InputX
());
}
void
RunImpl
()
const
{
param_
.
Out
()
->
ShareDataWith
(
*
param_
.
InputX
());
}
void
Init
()
const
{}
void
InferShape
()
const
{
void
InferShape
()
const
{
auto
x_dims
=
param_
.
InputX
()
->
dims
();
auto
x_dims
=
param_
.
InputX
()
->
dims
();
param_
.
Out
()
->
Resize
(
x_dims
);
param_
.
Out
()
->
Resize
(
x_dims
);
...
...
src/operators/kernel/arm/batchnorm_kernel.cpp
浏览文件 @
136c9f32
...
@@ -21,6 +21,11 @@ limitations under the License. */
...
@@ -21,6 +21,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
BatchNormKernel
<
CPU
,
float
>::
Init
(
const
BatchNormParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
BatchNormKernel
<
CPU
,
float
>::
Compute
(
const
BatchNormParam
&
param
)
const
{
void
BatchNormKernel
<
CPU
,
float
>::
Compute
(
const
BatchNormParam
&
param
)
const
{
const
Tensor
*
input_x
=
param
.
InputX
();
const
Tensor
*
input_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/box_coder_kernel.cpp
浏览文件 @
136c9f32
...
@@ -109,6 +109,11 @@ void DecodeCenterSize(const framework::Tensor& target_box,
...
@@ -109,6 +109,11 @@ void DecodeCenterSize(const framework::Tensor& target_box,
}
}
}
}
template
<
>
bool
BoxCoderKernel
<
CPU
,
float
>::
Init
(
const
BoxCoderParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
BoxCoderKernel
<
CPU
,
float
>::
Compute
(
const
BoxCoderParam
&
param
)
const
{
void
BoxCoderKernel
<
CPU
,
float
>::
Compute
(
const
BoxCoderParam
&
param
)
const
{
const
auto
*
input_priorbox
=
param
.
InputPriorBox
();
const
auto
*
input_priorbox
=
param
.
InputPriorBox
();
...
...
src/operators/kernel/arm/concat_kernel.cpp
浏览文件 @
136c9f32
...
@@ -52,6 +52,11 @@ class ConcatFunctor {
...
@@ -52,6 +52,11 @@ class ConcatFunctor {
}
}
};
};
template
<
>
bool
ConcatKernel
<
CPU
,
float
>::
Init
(
const
ConcatParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ConcatKernel
<
CPU
,
float
>::
Compute
(
const
ConcatParam
&
param
)
const
{
void
ConcatKernel
<
CPU
,
float
>::
Compute
(
const
ConcatParam
&
param
)
const
{
auto
inputs
=
param
.
Inputs
();
auto
inputs
=
param
.
Inputs
();
...
...
src/operators/kernel/arm/conv_add_kernel.cpp
浏览文件 @
136c9f32
...
@@ -18,6 +18,11 @@ limitations under the License. */
...
@@ -18,6 +18,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
ConvAddKernel
<
CPU
,
float
>::
Init
(
const
FusionConvAddParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ConvAddKernel
<
CPU
,
float
>::
Compute
(
const
FusionConvAddParam
&
param
)
const
{
void
ConvAddKernel
<
CPU
,
float
>::
Compute
(
const
FusionConvAddParam
&
param
)
const
{
const
Tensor
*
input
=
param
.
Input
();
const
Tensor
*
input
=
param
.
Input
();
...
...
src/operators/kernel/arm/conv_add_relu_kernel.cpp
浏览文件 @
136c9f32
...
@@ -19,6 +19,11 @@ limitations under the License. */
...
@@ -19,6 +19,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
ConvAddReluKernel
<
CPU
,
float
>::
Init
(
const
FusionConvAddReluParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ConvAddReluKernel
<
CPU
,
float
>::
Compute
(
void
ConvAddReluKernel
<
CPU
,
float
>::
Compute
(
const
FusionConvAddReluParam
&
param
)
const
{
const
FusionConvAddReluParam
&
param
)
const
{
...
...
src/operators/kernel/arm/conv_kernel.cpp
浏览文件 @
136c9f32
...
@@ -19,6 +19,11 @@ limitations under the License. */
...
@@ -19,6 +19,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
ConvKernel
<
CPU
,
float
>::
Init
(
const
ConvParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ConvKernel
<
CPU
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{
void
ConvKernel
<
CPU
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{
const
Tensor
*
input
=
param
.
Input
();
const
Tensor
*
input
=
param
.
Input
();
...
...
src/operators/kernel/arm/depthwise_conv_kernel.cpp
浏览文件 @
136c9f32
...
@@ -20,6 +20,11 @@ limitations under the License. */
...
@@ -20,6 +20,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
DepthwiseConvKernel
<
CPU
,
float
>::
Init
(
const
ConvParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
DepthwiseConvKernel
<
CPU
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{
void
DepthwiseConvKernel
<
CPU
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{
LOG
(
kLOG_DEBUG
)
<<
param
;
LOG
(
kLOG_DEBUG
)
<<
param
;
...
...
src/operators/kernel/arm/elementwise_add_kernel.cpp
浏览文件 @
136c9f32
...
@@ -26,6 +26,11 @@ struct AddFunctor {
...
@@ -26,6 +26,11 @@ struct AddFunctor {
inline
T
operator
()(
T
a
,
T
b
)
const
{
return
a
+
b
;
}
inline
T
operator
()(
T
a
,
T
b
)
const
{
return
a
+
b
;
}
};
};
template
<
>
bool
ElementwiseAddKernel
<
CPU
,
float
>::
Init
(
const
ElementwiseAddParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ElementwiseAddKernel
<
CPU
,
float
>::
Compute
(
void
ElementwiseAddKernel
<
CPU
,
float
>::
Compute
(
const
ElementwiseAddParam
&
param
)
const
{
const
ElementwiseAddParam
&
param
)
const
{
...
...
src/operators/kernel/arm/fusion_fc_kernel.cpp
浏览文件 @
136c9f32
...
@@ -21,6 +21,11 @@ limitations under the License. */
...
@@ -21,6 +21,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
FusionFcKernel
<
CPU
,
float
>::
Init
(
const
FusionFcParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
FusionFcKernel
<
CPU
,
float
>::
Compute
(
const
FusionFcParam
&
param
)
const
{
void
FusionFcKernel
<
CPU
,
float
>::
Compute
(
const
FusionFcParam
&
param
)
const
{
const
Tensor
*
input_x
=
param
.
InputX
();
const
Tensor
*
input_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/lrn_kernel.cpp
浏览文件 @
136c9f32
...
@@ -21,6 +21,11 @@ limitations under the License. */
...
@@ -21,6 +21,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
LrnKernel
<
CPU
,
float
>::
Init
(
const
LrnParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
LrnKernel
<
CPU
,
float
>::
Compute
(
const
LrnParam
&
param
)
const
{
void
LrnKernel
<
CPU
,
float
>::
Compute
(
const
LrnParam
&
param
)
const
{
const
Tensor
*
input_x
=
param
.
InputX
();
const
Tensor
*
input_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/mul_kernel.cpp
浏览文件 @
136c9f32
...
@@ -21,6 +21,11 @@ limitations under the License. */
...
@@ -21,6 +21,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
MulKernel
<
CPU
,
float
>::
Init
(
const
MulParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
MulKernel
<
CPU
,
float
>::
Compute
(
const
MulParam
&
param
)
const
{
void
MulKernel
<
CPU
,
float
>::
Compute
(
const
MulParam
&
param
)
const
{
const
Tensor
*
input_x
=
param
.
InputX
();
const
Tensor
*
input_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/multiclass_nms_kernel.cpp
浏览文件 @
136c9f32
...
@@ -205,6 +205,11 @@ void MultiClassOutput(const Tensor& scores, const Tensor& bboxes,
...
@@ -205,6 +205,11 @@ void MultiClassOutput(const Tensor& scores, const Tensor& bboxes,
}
}
}
}
template
<
>
bool
MultiClassNMSKernel
<
CPU
,
float
>::
Init
(
const
MultiClassNMSParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
MultiClassNMSKernel
<
CPU
,
float
>::
Compute
(
void
MultiClassNMSKernel
<
CPU
,
float
>::
Compute
(
const
MultiClassNMSParam
&
param
)
const
{
const
MultiClassNMSParam
&
param
)
const
{
...
...
src/operators/kernel/arm/pool_kernel.cpp
浏览文件 @
136c9f32
...
@@ -35,6 +35,11 @@ inline void PoolBasic(std::string pooling_type, std::vector<int> ksize,
...
@@ -35,6 +35,11 @@ inline void PoolBasic(std::string pooling_type, std::vector<int> ksize,
}
}
}
}
template
<
>
bool
PoolKernel
<
CPU
,
float
>::
Init
(
const
PoolParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
PoolKernel
<
CPU
,
float
>::
Compute
(
const
PoolParam
&
param
)
const
{
void
PoolKernel
<
CPU
,
float
>::
Compute
(
const
PoolParam
&
param
)
const
{
const
Tensor
*
in_x
=
param
.
Input
();
const
Tensor
*
in_x
=
param
.
Input
();
...
...
src/operators/kernel/arm/prior_box_kernel.cpp
浏览文件 @
136c9f32
...
@@ -28,6 +28,11 @@ struct ClipFunctor {
...
@@ -28,6 +28,11 @@ struct ClipFunctor {
}
}
};
};
template
<
>
bool
PriorBoxKernel
<
CPU
,
float
>::
Init
(
const
PriorBoxParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
PriorBoxKernel
<
CPU
,
float
>::
Compute
(
const
PriorBoxParam
&
param
)
const
{
void
PriorBoxKernel
<
CPU
,
float
>::
Compute
(
const
PriorBoxParam
&
param
)
const
{
const
auto
*
input_
=
param
.
Input
();
const
auto
*
input_
=
param
.
Input
();
...
...
src/operators/kernel/arm/relu_kernel.cpp
浏览文件 @
136c9f32
...
@@ -27,6 +27,11 @@ struct ReluFunctor {
...
@@ -27,6 +27,11 @@ struct ReluFunctor {
inline
T
operator
()(
T
in
)
const
{
return
in
>
0
?
in
:
0
;
}
inline
T
operator
()(
T
in
)
const
{
return
in
>
0
?
in
:
0
;
}
};
};
template
<
>
bool
ReluKernel
<
CPU
,
float
>::
Init
(
const
ReluParam
&
para
)
const
{
return
true
;
}
/*
/*
* @b 特化到具体平台的实现, param 从 op 层传入
* @b 特化到具体平台的实现, param 从 op 层传入
* */
* */
...
...
src/operators/kernel/arm/reshape_kernel.cpp
浏览文件 @
136c9f32
...
@@ -21,6 +21,11 @@ limitations under the License. */
...
@@ -21,6 +21,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
ReshapeKernel
<
CPU
,
float
>::
Init
(
const
ReshapeParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ReshapeKernel
<
CPU
,
float
>::
Compute
(
const
ReshapeParam
&
param
)
const
{
void
ReshapeKernel
<
CPU
,
float
>::
Compute
(
const
ReshapeParam
&
param
)
const
{
const
auto
*
input_x
=
param
.
InputX
();
const
auto
*
input_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/sigmoid_kernel.cpp
浏览文件 @
136c9f32
...
@@ -71,6 +71,11 @@ void sigmoid(const Tensor *X, Tensor *Y) {
...
@@ -71,6 +71,11 @@ void sigmoid(const Tensor *X, Tensor *Y) {
#endif
#endif
}
}
template
<
>
bool
SigmoidKernel
<
CPU
,
float
>::
Init
(
const
SigmoidParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
SigmoidKernel
<
CPU
,
float
>::
Compute
(
const
SigmoidParam
&
param
)
const
{
void
SigmoidKernel
<
CPU
,
float
>::
Compute
(
const
SigmoidParam
&
param
)
const
{
const
Tensor
*
in_x
=
param
.
InputX
();
const
Tensor
*
in_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/softmax_kernel.cpp
浏览文件 @
136c9f32
...
@@ -19,6 +19,11 @@ limitations under the License. */
...
@@ -19,6 +19,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
SoftmaxKernel
<
CPU
,
float
>::
Init
(
const
SoftmaxParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
SoftmaxKernel
<
CPU
,
float
>::
Compute
(
const
SoftmaxParam
&
param
)
const
{
void
SoftmaxKernel
<
CPU
,
float
>::
Compute
(
const
SoftmaxParam
&
param
)
const
{
const
Tensor
*
in_x
=
param
.
InputX
();
const
Tensor
*
in_x
=
param
.
InputX
();
...
...
src/operators/kernel/arm/transpose_kernel.cpp
浏览文件 @
136c9f32
...
@@ -34,6 +34,11 @@ namespace operators {
...
@@ -34,6 +34,11 @@ namespace operators {
// }
// }
// }
// }
template
<
>
bool
TransposeKernel
<
CPU
,
float
>::
Init
(
const
TransposeParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
TransposeKernel
<
CPU
,
float
>::
Compute
(
const
TransposeParam
&
param
)
const
{
void
TransposeKernel
<
CPU
,
float
>::
Compute
(
const
TransposeParam
&
param
)
const
{
const
auto
*
input_x
=
param
.
InputX
();
const
auto
*
input_x
=
param
.
InputX
();
...
...
src/operators/kernel/batchnorm_kernel.h
浏览文件 @
136c9f32
...
@@ -29,6 +29,7 @@ class BatchNormKernel
...
@@ -29,6 +29,7 @@ class BatchNormKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
BatchNormParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
BatchNormParam
>
{
public:
public:
void
Compute
(
const
BatchNormParam
&
param
)
const
;
void
Compute
(
const
BatchNormParam
&
param
)
const
;
bool
Init
(
const
BatchNormParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
...
...
src/operators/kernel/box_coder_kernel.h
浏览文件 @
136c9f32
...
@@ -30,6 +30,7 @@ class BoxCoderKernel
...
@@ -30,6 +30,7 @@ class BoxCoderKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
BoxCoderParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
BoxCoderParam
>
{
public:
public:
void
Compute
(
const
BoxCoderParam
&
param
)
const
;
void
Compute
(
const
BoxCoderParam
&
param
)
const
;
bool
Init
(
const
BoxCoderParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/concat_kernel.h
浏览文件 @
136c9f32
...
@@ -27,6 +27,7 @@ template <typename DeviceType, typename T>
...
@@ -27,6 +27,7 @@ template <typename DeviceType, typename T>
class
ConcatKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ConcatParam
>
{
class
ConcatKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ConcatParam
>
{
public:
public:
void
Compute
(
const
ConcatParam
&
param
)
const
;
void
Compute
(
const
ConcatParam
&
param
)
const
;
bool
Init
(
const
ConcatParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
...
...
src/operators/kernel/conv_add_kernel.h
浏览文件 @
136c9f32
...
@@ -38,6 +38,7 @@ template <typename DeviceType, typename T>
...
@@ -38,6 +38,7 @@ template <typename DeviceType, typename T>
class
ConvAddKernel
:
public
OpKernelBase
<
DeviceType
,
FusionConvAddParam
>
{
class
ConvAddKernel
:
public
OpKernelBase
<
DeviceType
,
FusionConvAddParam
>
{
public:
public:
void
Compute
(
const
FusionConvAddParam
&
param
)
const
;
void
Compute
(
const
FusionConvAddParam
&
param
)
const
;
bool
Init
(
const
FusionConvAddParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
...
...
src/operators/kernel/conv_add_relu_kernel.h
浏览文件 @
136c9f32
...
@@ -36,6 +36,7 @@ class ConvAddReluKernel
...
@@ -36,6 +36,7 @@ class ConvAddReluKernel
:
public
OpKernelBase
<
DeviceType
,
FusionConvAddReluParam
>
{
:
public
OpKernelBase
<
DeviceType
,
FusionConvAddReluParam
>
{
public:
public:
void
Compute
(
const
FusionConvAddReluParam
&
param
)
const
;
void
Compute
(
const
FusionConvAddReluParam
&
param
)
const
;
bool
Init
(
const
FusionConvAddReluParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
...
...
src/operators/kernel/conv_kernel.h
浏览文件 @
136c9f32
...
@@ -32,6 +32,7 @@ template <typename DeviceType, typename T>
...
@@ -32,6 +32,7 @@ template <typename DeviceType, typename T>
class
ConvKernel
:
public
OpKernelBase
<
DeviceType
,
ConvParam
>
{
class
ConvKernel
:
public
OpKernelBase
<
DeviceType
,
ConvParam
>
{
public:
public:
void
Compute
(
const
ConvParam
&
param
)
const
;
void
Compute
(
const
ConvParam
&
param
)
const
;
bool
Init
(
const
ConvParam
&
para
)
const
;
};
};
inline
bool
IsExpand
(
const
std
::
vector
<
int64_t
>
&
filter_dim
,
inline
bool
IsExpand
(
const
std
::
vector
<
int64_t
>
&
filter_dim
,
...
...
src/operators/kernel/depthwise_conv_kernel.h
浏览文件 @
136c9f32
...
@@ -31,6 +31,7 @@ template <typename DeviceType, typename T>
...
@@ -31,6 +31,7 @@ template <typename DeviceType, typename T>
class
DepthwiseConvKernel
:
public
OpKernelBase
<
DeviceType
,
ConvParam
>
{
class
DepthwiseConvKernel
:
public
OpKernelBase
<
DeviceType
,
ConvParam
>
{
public:
public:
void
Compute
(
const
ConvParam
&
param
)
const
;
void
Compute
(
const
ConvParam
&
param
)
const
;
bool
Init
(
const
ConvParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/elementwise_add_kernel.h
浏览文件 @
136c9f32
...
@@ -30,6 +30,7 @@ class ElementwiseAddKernel
...
@@ -30,6 +30,7 @@ class ElementwiseAddKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ElementwiseAddParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
ElementwiseAddParam
>
{
public:
public:
void
Compute
(
const
ElementwiseAddParam
&
param
)
const
;
void
Compute
(
const
ElementwiseAddParam
&
param
)
const
;
bool
Init
(
const
ElementwiseAddParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/fpga/conv_kernel.cpp
浏览文件 @
136c9f32
...
@@ -19,6 +19,11 @@ limitations under the License. */
...
@@ -19,6 +19,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
ConvKernel
<
FPGA
,
float
>::
Init
(
const
ConvParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ConvKernel
<
FPGA
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{}
void
ConvKernel
<
FPGA
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{}
template
class
ConvKernel
<
FPGA
,
float
>;
template
class
ConvKernel
<
FPGA
,
float
>;
...
...
src/operators/kernel/fusion_fc_kernel.h
浏览文件 @
136c9f32
...
@@ -28,6 +28,7 @@ class FusionFcKernel
...
@@ -28,6 +28,7 @@ class FusionFcKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
FusionFcParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
FusionFcParam
>
{
public:
public:
void
Compute
(
const
FusionFcParam
&
param
)
const
;
void
Compute
(
const
FusionFcParam
&
param
)
const
;
bool
Init
(
const
FusionFcParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/lrn_kernel.h
浏览文件 @
136c9f32
...
@@ -169,6 +169,7 @@ template <typename DeviceType, typename T>
...
@@ -169,6 +169,7 @@ template <typename DeviceType, typename T>
class
LrnKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
LrnParam
>
{
class
LrnKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
LrnParam
>
{
public:
public:
void
Compute
(
const
LrnParam
&
param
)
const
;
void
Compute
(
const
LrnParam
&
param
)
const
;
bool
Init
(
const
LrnParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/mali/batchnorm_kernel.cpp
浏览文件 @
136c9f32
...
@@ -21,6 +21,11 @@ limitations under the License. */
...
@@ -21,6 +21,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
BatchNormKernel
<
GPU_MALI
,
float
>::
Init
(
const
BatchNormParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
BatchNormKernel
<
GPU_MALI
,
float
>::
Compute
(
void
BatchNormKernel
<
GPU_MALI
,
float
>::
Compute
(
const
BatchNormParam
&
param
)
const
{}
const
BatchNormParam
&
param
)
const
{}
...
...
src/operators/kernel/mali/conv_kernel.cpp
浏览文件 @
136c9f32
...
@@ -19,6 +19,11 @@ limitations under the License. */
...
@@ -19,6 +19,11 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{
template
<
>
bool
ConvKernel
<
GPU_MALI
,
float
>::
Init
(
const
ConvParam
&
para
)
const
{
return
true
;
}
template
<
>
template
<
>
void
ConvKernel
<
GPU_MALI
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{
void
ConvKernel
<
GPU_MALI
,
float
>::
Compute
(
const
ConvParam
&
param
)
const
{
// ArmConvImplement imp;
// ArmConvImplement imp;
...
...
src/operators/kernel/mul_kernel.h
浏览文件 @
136c9f32
...
@@ -29,6 +29,7 @@ template <typename DeviceType, typename T>
...
@@ -29,6 +29,7 @@ template <typename DeviceType, typename T>
class
MulKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
MulParam
>
{
class
MulKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
MulParam
>
{
public:
public:
void
Compute
(
const
MulParam
&
param
)
const
;
void
Compute
(
const
MulParam
&
param
)
const
;
bool
Init
(
const
MulParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/multiclass_nms_kernel.h
浏览文件 @
136c9f32
...
@@ -28,6 +28,7 @@ class MultiClassNMSKernel
...
@@ -28,6 +28,7 @@ class MultiClassNMSKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
MultiClassNMSParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
MultiClassNMSParam
>
{
public:
public:
void
Compute
(
const
MultiClassNMSParam
&
param
)
const
;
void
Compute
(
const
MultiClassNMSParam
&
param
)
const
;
bool
Init
(
const
MultiClassNMSParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/pool_kernel.h
浏览文件 @
136c9f32
...
@@ -28,6 +28,7 @@ template <typename DeviceType, typename T>
...
@@ -28,6 +28,7 @@ template <typename DeviceType, typename T>
class
PoolKernel
:
public
OpKernelBase
<
DeviceType
,
PoolParam
>
{
class
PoolKernel
:
public
OpKernelBase
<
DeviceType
,
PoolParam
>
{
public:
public:
void
Compute
(
const
PoolParam
&
param
)
const
override
;
void
Compute
(
const
PoolParam
&
param
)
const
override
;
bool
Init
(
const
PoolParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/prior_box_kernel.h
浏览文件 @
136c9f32
...
@@ -54,6 +54,7 @@ class PriorBoxKernel
...
@@ -54,6 +54,7 @@ class PriorBoxKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
PriorBoxParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
PriorBoxParam
>
{
public:
public:
void
Compute
(
const
PriorBoxParam
&
param
)
const
;
void
Compute
(
const
PriorBoxParam
&
param
)
const
;
bool
Init
(
const
PriorBoxParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/relu_kernel.h
浏览文件 @
136c9f32
...
@@ -27,6 +27,7 @@ template <typename DeviceType, typename T>
...
@@ -27,6 +27,7 @@ template <typename DeviceType, typename T>
class
ReluKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ReluParam
>
{
class
ReluKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ReluParam
>
{
public:
public:
void
Compute
(
const
ReluParam
&
param
)
const
;
void
Compute
(
const
ReluParam
&
param
)
const
;
bool
Init
(
const
ReluParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/reshape_kernel.h
浏览文件 @
136c9f32
...
@@ -71,6 +71,7 @@ template <typename DeviceType, typename T>
...
@@ -71,6 +71,7 @@ template <typename DeviceType, typename T>
class
ReshapeKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ReshapeParam
>
{
class
ReshapeKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
ReshapeParam
>
{
public:
public:
void
Compute
(
const
ReshapeParam
&
param
)
const
;
void
Compute
(
const
ReshapeParam
&
param
)
const
;
bool
Init
(
const
ReshapeParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/sigmoid_kernel.h
浏览文件 @
136c9f32
...
@@ -26,6 +26,7 @@ template <typename DeviceType, typename T>
...
@@ -26,6 +26,7 @@ template <typename DeviceType, typename T>
class
SigmoidKernel
:
public
OpKernelBase
<
DeviceType
,
SigmoidParam
>
{
class
SigmoidKernel
:
public
OpKernelBase
<
DeviceType
,
SigmoidParam
>
{
public:
public:
void
Compute
(
const
SigmoidParam
&
param
)
const
override
;
void
Compute
(
const
SigmoidParam
&
param
)
const
override
;
bool
Init
(
const
SigmoidParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/softmax_kernel.h
浏览文件 @
136c9f32
...
@@ -29,6 +29,7 @@ template <typename DeviceType, typename T>
...
@@ -29,6 +29,7 @@ template <typename DeviceType, typename T>
class
SoftmaxKernel
:
public
OpKernelBase
<
DeviceType
,
SoftmaxParam
>
{
class
SoftmaxKernel
:
public
OpKernelBase
<
DeviceType
,
SoftmaxParam
>
{
public:
public:
void
Compute
(
const
SoftmaxParam
&
param
)
const
override
;
void
Compute
(
const
SoftmaxParam
&
param
)
const
override
;
bool
Init
(
const
SoftmaxParam
&
para
)
const
;
};
};
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/transpose_kernel.h
浏览文件 @
136c9f32
...
@@ -29,6 +29,7 @@ class TransposeKernel
...
@@ -29,6 +29,7 @@ class TransposeKernel
:
public
framework
::
OpKernelBase
<
DeviceType
,
TransposeParam
>
{
:
public
framework
::
OpKernelBase
<
DeviceType
,
TransposeParam
>
{
public:
public:
void
Compute
(
const
TransposeParam
&
param
)
const
;
void
Compute
(
const
TransposeParam
&
param
)
const
;
bool
Init
(
const
TransposeParam
&
para
)
const
;
};
};
}
// 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录