Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
74dd8366
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看板
提交
74dd8366
编写于
7月 17, 2018
作者:
W
wangliu
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'upstream/develop' into develop
上级
e1bd9919
1df980ec
变更
41
隐藏空白更改
内联
并排
Showing
41 changed file
with
44 addition
and
76 deletion
+44
-76
src/common/variant.h
src/common/variant.h
+1
-1
src/framework/program/program-optimize/fusion_op_register.h
src/framework/program/program-optimize/fusion_op_register.h
+11
-2
src/framework/program/program-optimize/node.cpp
src/framework/program/program-optimize/node.cpp
+0
-17
src/framework/program/program-optimize/node.h
src/framework/program/program-optimize/node.h
+0
-3
src/framework/program/program-optimize/program_optimize.cpp
src/framework/program/program-optimize/program_optimize.cpp
+2
-3
src/operators/batchnorm_op.cpp
src/operators/batchnorm_op.cpp
+1
-1
src/operators/box_coder_op.cpp
src/operators/box_coder_op.cpp
+1
-1
src/operators/concat_op.cpp
src/operators/concat_op.cpp
+0
-1
src/operators/conv_op.cpp
src/operators/conv_op.cpp
+0
-2
src/operators/depthwise_conv_op.cpp
src/operators/depthwise_conv_op.cpp
+0
-2
src/operators/dropout_op.cpp
src/operators/dropout_op.cpp
+1
-1
src/operators/elementwise_add_op.cpp
src/operators/elementwise_add_op.cpp
+1
-1
src/operators/feed_op.cpp
src/operators/feed_op.cpp
+1
-4
src/operators/fetch_op.cpp
src/operators/fetch_op.cpp
+1
-4
src/operators/fusion_conv_add.cpp
src/operators/fusion_conv_add.cpp
+0
-1
src/operators/fusion_conv_add.h
src/operators/fusion_conv_add.h
+0
-2
src/operators/fusion_conv_add_bn_relu_op.cpp
src/operators/fusion_conv_add_bn_relu_op.cpp
+1
-1
src/operators/fusion_conv_add_bn_relu_op.h
src/operators/fusion_conv_add_bn_relu_op.h
+0
-2
src/operators/fusion_dwconv_bn_relu_op.cpp
src/operators/fusion_dwconv_bn_relu_op.cpp
+1
-1
src/operators/fusion_dwconv_bn_relu_op.h
src/operators/fusion_dwconv_bn_relu_op.h
+0
-2
src/operators/fusion_fc_op.cpp
src/operators/fusion_fc_op.cpp
+0
-1
src/operators/im2sequence_op.cpp
src/operators/im2sequence_op.cpp
+0
-2
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
+1
-1
src/operators/kernel/central-arm-func/dwconv_bn_relu_arm_func.h
...erators/kernel/central-arm-func/dwconv_bn_relu_arm_func.h
+1
-2
src/operators/lrn_op.cpp
src/operators/lrn_op.cpp
+1
-1
src/operators/math/math_function.cpp
src/operators/math/math_function.cpp
+3
-2
src/operators/math/math_function.h
src/operators/math/math_function.h
+2
-1
src/operators/mul_op.cpp
src/operators/mul_op.cpp
+1
-1
src/operators/multiclass_nms_op.cpp
src/operators/multiclass_nms_op.cpp
+1
-1
src/operators/op_param.h
src/operators/op_param.h
+1
-1
src/operators/pool_op.cpp
src/operators/pool_op.cpp
+1
-1
src/operators/prelu_op.cpp
src/operators/prelu_op.cpp
+1
-1
src/operators/prior_box_op.cpp
src/operators/prior_box_op.cpp
+1
-1
src/operators/relu_op.cpp
src/operators/relu_op.cpp
+1
-1
src/operators/reshape_op.cpp
src/operators/reshape_op.cpp
+1
-1
src/operators/resize_op.cpp
src/operators/resize_op.cpp
+1
-1
src/operators/scale_op.cpp
src/operators/scale_op.cpp
+1
-1
src/operators/sigmoid_op.cpp
src/operators/sigmoid_op.cpp
+1
-1
src/operators/slice_op.cpp
src/operators/slice_op.cpp
+1
-1
src/operators/softmax_op.cpp
src/operators/softmax_op.cpp
+1
-1
src/operators/transpose_op.cpp
src/operators/transpose_op.cpp
+1
-1
未找到文件。
src/common/variant.h
浏览文件 @
74dd8366
...
@@ -84,7 +84,7 @@ struct Variant {
...
@@ -84,7 +84,7 @@ struct Variant {
if
(
type_id
==
typeid
(
T
).
hash_code
())
{
if
(
type_id
==
typeid
(
T
).
hash_code
())
{
return
*
const_cast
<
T
*>
(
reinterpret_cast
<
const
T
*>
(
&
data
));
return
*
const_cast
<
T
*>
(
reinterpret_cast
<
const
T
*>
(
&
data
));
}
else
{
}
else
{
PADDLE_MOBILE_THROW_EXCEPTION
(
" bad cast in variant
"
);
PADDLE_MOBILE_THROW_EXCEPTION
(
" bad cast in variant"
);
exit
(
0
);
exit
(
0
);
}
}
}
}
...
...
src/framework/program/program-optimize/fusion_op_register.h
浏览文件 @
74dd8366
...
@@ -42,8 +42,17 @@ class FusionOpRegister {
...
@@ -42,8 +42,17 @@ class FusionOpRegister {
matchers_
[
matcher
->
Type
()]
=
shared_matcher
;
matchers_
[
matcher
->
Type
()]
=
shared_matcher
;
}
}
const
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
FusionOpMatcher
>>
Matchers
()
{
const
std
::
vector
<
std
::
shared_ptr
<
FusionOpMatcher
>>
Matchers
()
{
return
matchers_
;
std
::
vector
<
std
::
shared_ptr
<
FusionOpMatcher
>>
matchers
;
for
(
const
auto
&
match
:
matchers_
)
{
matchers
.
push_back
(
match
.
second
);
}
std
::
sort
(
matchers
.
begin
(),
matchers
.
end
(),
[](
std
::
shared_ptr
<
FusionOpMatcher
>
first
,
std
::
shared_ptr
<
FusionOpMatcher
>
second
)
{
return
first
->
BeginNode
().
Depth
()
>
second
->
BeginNode
().
Depth
();
});
return
matchers
;
}
}
private:
private:
...
...
src/framework/program/program-optimize/node.cpp
浏览文件 @
74dd8366
...
@@ -44,23 +44,6 @@ bool Node::operator==(const Node &in) {
...
@@ -44,23 +44,6 @@ bool Node::operator==(const Node &in) {
return
true
;
return
true
;
}
}
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
Node
::
OpDescs
(
int
size
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
op_descs
;
OpDescs
(
size
-
1
,
&
op_descs
);
return
op_descs
;
}
void
Node
::
OpDescs
(
int
index
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
*
op_desc
)
{
if
(
index
==
0
)
{
return
;
}
op_desc
->
push_back
(
this
->
op_desc_
);
for
(
auto
&
output
:
outputs_
)
{
output
->
OpDescs
(
index
,
op_desc
);
}
}
std
::
shared_ptr
<
Node
>
Node
::
To
(
int
size
)
{
std
::
shared_ptr
<
Node
>
Node
::
To
(
int
size
)
{
std
::
shared_ptr
<
Node
>
node
=
std
::
make_shared
<
Node
>
();
std
::
shared_ptr
<
Node
>
node
=
std
::
make_shared
<
Node
>
();
this
->
To
(
size
-
1
,
node
);
this
->
To
(
size
-
1
,
node
);
...
...
src/framework/program/program-optimize/node.h
浏览文件 @
74dd8366
...
@@ -47,13 +47,10 @@ class Node {
...
@@ -47,13 +47,10 @@ class Node {
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>>
std
::
map
<
std
::
string
,
std
::
vector
<
std
::
pair
<
std
::
string
,
std
::
string
>>>
change
,
change
,
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
removed_nodes
);
std
::
vector
<
std
::
shared_ptr
<
Node
>>
*
removed_nodes
);
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
OpDescs
(
int
size
);
std
::
shared_ptr
<
framework
::
OpDesc
>
OpDescOfNode
()
{
return
op_desc_
;
}
std
::
shared_ptr
<
framework
::
OpDesc
>
OpDescOfNode
()
{
return
op_desc_
;
}
std
::
string
Type
()
{
return
type_
;
}
std
::
string
Type
()
{
return
type_
;
}
private:
private:
void
OpDescs
(
int
size
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
*
op_desc
);
void
To
(
int
index
,
std
::
shared_ptr
<
Node
>
);
void
To
(
int
index
,
std
::
shared_ptr
<
Node
>
);
void
Folder
(
void
Folder
(
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
,
std
::
shared_ptr
<
framework
::
OpDesc
>
op_desc
,
...
...
src/framework/program/program-optimize/program_optimize.cpp
浏览文件 @
74dd8366
...
@@ -78,9 +78,8 @@ std::shared_ptr<ProgramDesc> ProgramOptimize::FusionOptimize(
...
@@ -78,9 +78,8 @@ std::shared_ptr<ProgramDesc> ProgramOptimize::FusionOptimize(
}
}
for
(
auto
&
registed
:
FusionOpRegister
::
Instance
()
->
Matchers
())
{
for
(
auto
&
registed
:
FusionOpRegister
::
Instance
()
->
Matchers
())
{
std
::
string
fusion_type
=
registed
.
first
;
std
::
string
fusion_type
=
registed
->
Type
();
std
::
shared_ptr
<
FusionOpMatcher
>
matcher
=
registed
.
second
;
std
::
shared_ptr
<
FusionOpMatcher
>
matcher
=
registed
;
// DLOG << " registed node \n " << matcher->BeginNode();
auto
match_vector
=
type_map
[
matcher
->
BeginType
()];
auto
match_vector
=
type_map
[
matcher
->
BeginType
()];
...
...
src/operators/batchnorm_op.cpp
浏览文件 @
74dd8366
...
@@ -26,7 +26,7 @@ void BatchNormOp<Dtype, T>::InferShape() const {
...
@@ -26,7 +26,7 @@ void BatchNormOp<Dtype, T>::InferShape() const {
auto
x_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
x_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
OutputY
()
->
Resize
(
x_dims
);
this
->
param_
.
OutputY
()
->
Resize
(
x_dims
);
}
}
template
class
BatchNormOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/box_coder_op.cpp
浏览文件 @
74dd8366
...
@@ -47,7 +47,7 @@ void BoxCoderOp<Dtype, T>::InferShape() const {
...
@@ -47,7 +47,7 @@ void BoxCoderOp<Dtype, T>::InferShape() const {
this
->
param_
.
OutputBox
()
->
Resize
(
framework
::
make_ddim
(
this
->
param_
.
OutputBox
()
->
Resize
(
framework
::
make_ddim
(
{
input_targetbox_dims
[
0
],
input_priorbox_dims
[
0
],
4
}));
{
input_targetbox_dims
[
0
],
input_priorbox_dims
[
0
],
4
}));
}
}
template
class
BoxCoderOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/concat_op.cpp
浏览文件 @
74dd8366
...
@@ -56,7 +56,6 @@ void ConcatOp<Dtype, T>::InferShape() const {
...
@@ -56,7 +56,6 @@ void ConcatOp<Dtype, T>::InferShape() const {
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
}
}
template
class
ConcatOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/conv_op.cpp
浏览文件 @
74dd8366
...
@@ -48,8 +48,6 @@ void ConvOp<Dtype, T>::InferShape() const {
...
@@ -48,8 +48,6 @@ void ConvOp<Dtype, T>::InferShape() const {
this
->
param_
.
Output
()
->
Resize
(
ddim
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
}
}
template
class
ConvOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/depthwise_conv_op.cpp
浏览文件 @
74dd8366
...
@@ -49,8 +49,6 @@ void DepthwiseConvOp<Dtype, T>::InferShape() const {
...
@@ -49,8 +49,6 @@ void DepthwiseConvOp<Dtype, T>::InferShape() const {
this
->
param_
.
Output
()
->
Resize
(
ddim
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
}
}
template
class
DepthwiseConvOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/dropout_op.cpp
浏览文件 @
74dd8366
...
@@ -22,7 +22,7 @@ void DropoutOp<Dtype, T>::InferShape() const {
...
@@ -22,7 +22,7 @@ void DropoutOp<Dtype, T>::InferShape() const {
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
}
}
template
class
DropoutOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/elementwise_add_op.cpp
浏览文件 @
74dd8366
...
@@ -24,7 +24,7 @@ void ElementwiseAddOp<Dtype, T>::InferShape() const {
...
@@ -24,7 +24,7 @@ void ElementwiseAddOp<Dtype, T>::InferShape() const {
auto
x_dim
=
this
->
param_
.
InputX
()
->
dims
();
auto
x_dim
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
x_dim
);
this
->
param_
.
Out
()
->
Resize
(
x_dim
);
}
}
template
class
ElementwiseAddOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/feed_op.cpp
浏览文件 @
74dd8366
...
@@ -14,10 +14,7 @@ limitations under the License. */
...
@@ -14,10 +14,7 @@ limitations under the License. */
#include "feed_op.h"
#include "feed_op.h"
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{}
template
class
FeedOp
<
CPU
,
float
>;
}
}
// namespace paddle_mobile
}
// namespace paddle_mobile
namespace
ops
=
paddle_mobile
::
operators
;
namespace
ops
=
paddle_mobile
::
operators
;
...
...
src/operators/fetch_op.cpp
浏览文件 @
74dd8366
...
@@ -14,10 +14,7 @@ limitations under the License. */
...
@@ -14,10 +14,7 @@ limitations under the License. */
#include "fetch_op.h"
#include "fetch_op.h"
namespace
paddle_mobile
{
namespace
paddle_mobile
{
namespace
operators
{
namespace
operators
{}
template
class
FetchOp
<
CPU
,
float
>;
}
}
// namespace paddle_mobile
}
// namespace paddle_mobile
namespace
ops
=
paddle_mobile
::
operators
;
namespace
ops
=
paddle_mobile
::
operators
;
...
...
src/operators/fusion_conv_add.cpp
浏览文件 @
74dd8366
...
@@ -45,7 +45,6 @@ void FusionConvAddOp<Dtype, T>::InferShape() const {
...
@@ -45,7 +45,6 @@ void FusionConvAddOp<Dtype, T>::InferShape() const {
this
->
param_
.
Output
()
->
Resize
(
ddim
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
}
}
template
class
FusionConvAddOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/fusion_conv_add.h
浏览文件 @
74dd8366
...
@@ -36,8 +36,6 @@ class FusionConvAddMatcher : public framework::FusionOpMatcher {
...
@@ -36,8 +36,6 @@ class FusionConvAddMatcher : public framework::FusionOpMatcher {
void
FolderNodes
(
void
FolderNodes
(
framework
::
Node
*
node
,
framework
::
Node
*
node
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
->
OpDescs
(
node_
.
Depth
());
node
->
Folder
(
node_
.
Depth
(),
Type
(),
node
->
Folder
(
node_
.
Depth
(),
Type
(),
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"Y"
,
"Y"
}}}},
removed_nodes
);
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"Y"
,
"Y"
}}}},
removed_nodes
);
}
}
...
...
src/operators/fusion_conv_add_bn_relu_op.cpp
浏览文件 @
74dd8366
...
@@ -44,7 +44,7 @@ void FusionConvAddBNReluOp<Dtype, T>::InferShape() const {
...
@@ -44,7 +44,7 @@ void FusionConvAddBNReluOp<Dtype, T>::InferShape() const {
framework
::
DDim
ddim
=
framework
::
make_ddim
(
output_shape
);
framework
::
DDim
ddim
=
framework
::
make_ddim
(
output_shape
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
}
}
template
class
FusionConvAddBNReluOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/fusion_conv_add_bn_relu_op.h
浏览文件 @
74dd8366
...
@@ -39,8 +39,6 @@ class FusionConvAddBNReluMatcher : public framework::FusionOpMatcher {
...
@@ -39,8 +39,6 @@ class FusionConvAddBNReluMatcher : public framework::FusionOpMatcher {
void
FolderNodes
(
void
FolderNodes
(
framework
::
Node
*
node
,
framework
::
Node
*
node
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
->
OpDescs
(
node_
.
Depth
());
node
->
Folder
(
node_
.
Depth
(),
Type
(),
node
->
Folder
(
node_
.
Depth
(),
Type
(),
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"Y"
,
"Y"
}}},
{{
G_OP_TYPE_ELEMENTWISE_ADD
,
{{
"Y"
,
"Y"
}}},
{
G_OP_TYPE_BATCHNORM
,
{
G_OP_TYPE_BATCHNORM
,
...
...
src/operators/fusion_dwconv_bn_relu_op.cpp
浏览文件 @
74dd8366
...
@@ -44,7 +44,7 @@ void FusionDWConvBNReluOp<Dtype, T>::InferShape() const {
...
@@ -44,7 +44,7 @@ void FusionDWConvBNReluOp<Dtype, T>::InferShape() const {
framework
::
DDim
ddim
=
framework
::
make_ddim
(
output_shape
);
framework
::
DDim
ddim
=
framework
::
make_ddim
(
output_shape
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
}
}
template
class
FusionDWConvBNReluOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/fusion_dwconv_bn_relu_op.h
浏览文件 @
74dd8366
...
@@ -38,8 +38,6 @@ class FusionDWConvBNReluMatcher : public framework::FusionOpMatcher {
...
@@ -38,8 +38,6 @@ class FusionDWConvBNReluMatcher : public framework::FusionOpMatcher {
void
FolderNodes
(
void
FolderNodes
(
framework
::
Node
*
node
,
framework
::
Node
*
node
,
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
Node
>>
*
removed_nodes
)
{
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
->
OpDescs
(
node_
.
Depth
());
node
->
Folder
(
node_
.
Depth
(),
Type
(),
node
->
Folder
(
node_
.
Depth
(),
Type
(),
{{
G_OP_TYPE_BATCHNORM
,
{{
G_OP_TYPE_BATCHNORM
,
{{
"Scale"
,
"Scale"
},
{{
"Scale"
,
"Scale"
},
...
...
src/operators/fusion_fc_op.cpp
浏览文件 @
74dd8366
...
@@ -50,7 +50,6 @@ void FusionFcOp<Dtype, T>::InferShape() const {
...
@@ -50,7 +50,6 @@ void FusionFcOp<Dtype, T>::InferShape() const {
this
->
param_
.
Out
()
->
Resize
(
ddim
);
this
->
param_
.
Out
()
->
Resize
(
ddim
);
}
}
template
class
FusionFcOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/im2sequence_op.cpp
浏览文件 @
74dd8366
...
@@ -47,8 +47,6 @@ void Im2SequenceOp<Dtype, T>::InferShape() const {
...
@@ -47,8 +47,6 @@ void Im2SequenceOp<Dtype, T>::InferShape() const {
this
->
param_
.
Output
()
->
Resize
(
ddim
);
this
->
param_
.
Output
()
->
Resize
(
ddim
);
}
}
template
class
Im2SequenceOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/kernel/central-arm-func/conv_add_bn_relu_arm_func.h
浏览文件 @
74dd8366
...
@@ -104,7 +104,7 @@ void ConvAddBNReluBasic(const FusionConvAddBNReluParam ¶m) {
...
@@ -104,7 +104,7 @@ void ConvAddBNReluBasic(const FusionConvAddBNReluParam ¶m) {
math
::
matmulWithBn
<
float
>
(
math
::
matmulWithBn
<
float
>
(
filter_slice
,
false
,
col_matrix
,
false
,
static_cast
<
float
>
(
1
),
filter_slice
,
false
,
col_matrix
,
false
,
static_cast
<
float
>
(
1
),
&
out_slice
,
static_cast
<
float
>
(
0
),
true
,
&
new_scale
,
&
new_bias
);
&
out_slice
,
static_cast
<
float
>
(
0
),
true
,
&
new_scale
,
&
new_bias
,
g
);
}
}
}
}
}
}
...
...
src/operators/kernel/central-arm-func/dwconv_bn_relu_arm_func.h
浏览文件 @
74dd8366
...
@@ -101,10 +101,9 @@ void DWConvBNReluBasic(const FusionDWConvBNReluParam ¶m) {
...
@@ -101,10 +101,9 @@ void DWConvBNReluBasic(const FusionDWConvBNReluParam ¶m) {
// gemm
// gemm
Tensor
out_slice
=
out_batch
.
Slice
(
g
*
out_step
,
(
g
+
1
)
*
out_step
);
Tensor
out_slice
=
out_batch
.
Slice
(
g
*
out_step
,
(
g
+
1
)
*
out_step
);
Tensor
filter_slice
=
filter
.
Slice
(
g
*
out_step
,
(
g
+
1
)
*
out_step
);
Tensor
filter_slice
=
filter
.
Slice
(
g
*
out_step
,
(
g
+
1
)
*
out_step
);
std
::
cout
<<
"***************"
<<
std
::
endl
;
math
::
matmulWithBn
<
float
>
(
math
::
matmulWithBn
<
float
>
(
filter_slice
,
false
,
col_matrix
,
false
,
static_cast
<
float
>
(
1
),
filter_slice
,
false
,
col_matrix
,
false
,
static_cast
<
float
>
(
1
),
&
out_slice
,
static_cast
<
float
>
(
0
),
false
,
&
new_scale
,
&
new_bias
);
&
out_slice
,
static_cast
<
float
>
(
0
),
true
,
&
new_scale
,
&
new_bias
,
g
);
}
}
}
}
}
}
...
...
src/operators/lrn_op.cpp
浏览文件 @
74dd8366
...
@@ -24,7 +24,7 @@ void LrnOp<Dtype, T>::InferShape() const {
...
@@ -24,7 +24,7 @@ void LrnOp<Dtype, T>::InferShape() const {
auto
x_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
x_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
x_dims
);
this
->
param_
.
Out
()
->
Resize
(
x_dims
);
}
}
template
class
LrnOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/math/math_function.cpp
浏览文件 @
74dd8366
...
@@ -50,7 +50,7 @@ void matmulWithBn<float>(const framework::Tensor &matrix_a, bool trans_a,
...
@@ -50,7 +50,7 @@ void matmulWithBn<float>(const framework::Tensor &matrix_a, bool trans_a,
const
framework
::
Tensor
&
matrix_b
,
bool
trans_b
,
const
framework
::
Tensor
&
matrix_b
,
bool
trans_b
,
float
alpha
,
framework
::
Tensor
*
matrix_out
,
float
beta
,
float
alpha
,
framework
::
Tensor
*
matrix_out
,
float
beta
,
bool
relu
,
framework
::
Tensor
*
new_scale
,
bool
relu
,
framework
::
Tensor
*
new_scale
,
framework
::
Tensor
*
new_bias
)
{
framework
::
Tensor
*
new_bias
,
int
group
)
{
auto
dim_a
=
matrix_a
.
dims
();
auto
dim_a
=
matrix_a
.
dims
();
auto
dim_b
=
matrix_b
.
dims
();
auto
dim_b
=
matrix_b
.
dims
();
auto
dim_out
=
matrix_out
->
dims
();
auto
dim_out
=
matrix_out
->
dims
();
...
@@ -71,7 +71,8 @@ void matmulWithBn<float>(const framework::Tensor &matrix_a, bool trans_a,
...
@@ -71,7 +71,8 @@ void matmulWithBn<float>(const framework::Tensor &matrix_a, bool trans_a,
SgemmWithBn
(
M
,
N
,
K
,
alpha
,
matrix_a
.
data
<
float
>
(),
K
,
matrix_b
.
data
<
float
>
(),
SgemmWithBn
(
M
,
N
,
K
,
alpha
,
matrix_a
.
data
<
float
>
(),
K
,
matrix_b
.
data
<
float
>
(),
N
,
beta
,
matrix_out
->
data
<
float
>
(),
N
,
relu
,
N
,
beta
,
matrix_out
->
data
<
float
>
(),
N
,
relu
,
new_scale
->
data
<
float
>
(),
new_bias
->
data
<
float
>
());
new_scale
->
data
<
float
>
()
+
group
,
new_bias
->
data
<
float
>
()
+
group
);
}
}
}
// namespace math
}
// namespace math
...
...
src/operators/math/math_function.h
浏览文件 @
74dd8366
...
@@ -31,7 +31,8 @@ template <typename T>
...
@@ -31,7 +31,8 @@ template <typename T>
void
matmulWithBn
(
const
framework
::
Tensor
&
matrix_a
,
bool
trans_a
,
void
matmulWithBn
(
const
framework
::
Tensor
&
matrix_a
,
bool
trans_a
,
const
framework
::
Tensor
&
matrix_b
,
bool
trans_b
,
T
alpha
,
const
framework
::
Tensor
&
matrix_b
,
bool
trans_b
,
T
alpha
,
framework
::
Tensor
*
matrix_out
,
T
beta
,
bool
relu
,
framework
::
Tensor
*
matrix_out
,
T
beta
,
bool
relu
,
framework
::
Tensor
*
new_scale
,
framework
::
Tensor
*
new_bias
);
framework
::
Tensor
*
new_scale
,
framework
::
Tensor
*
new_bias
,
int
group
);
}
// namespace math
}
// namespace math
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
src/operators/mul_op.cpp
浏览文件 @
74dd8366
...
@@ -50,7 +50,7 @@ void MulOp<Dtype, T>::InferShape() const {
...
@@ -50,7 +50,7 @@ void MulOp<Dtype, T>::InferShape() const {
framework
::
DDim
ddim
=
framework
::
make_ddim
(
output_dims
);
framework
::
DDim
ddim
=
framework
::
make_ddim
(
output_dims
);
this
->
param_
.
Out
()
->
Resize
(
ddim
);
this
->
param_
.
Out
()
->
Resize
(
ddim
);
}
}
template
class
MulOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/multiclass_nms_op.cpp
浏览文件 @
74dd8366
...
@@ -34,7 +34,7 @@ void MultiClassNMSOp<Dtype, T>::InferShape() const {
...
@@ -34,7 +34,7 @@ void MultiClassNMSOp<Dtype, T>::InferShape() const {
// pre size, will change in Compute.
// pre size, will change in Compute.
this
->
param_
.
Out
()
->
Resize
(
framework
::
make_ddim
({
input_bboxes_dims
[
1
],
6
}));
this
->
param_
.
Out
()
->
Resize
(
framework
::
make_ddim
({
input_bboxes_dims
[
1
],
6
}));
}
}
template
class
MultiClassNMSOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/op_param.h
浏览文件 @
74dd8366
...
@@ -371,7 +371,7 @@ class BatchNormParam : OpParam {
...
@@ -371,7 +371,7 @@ class BatchNormParam : OpParam {
input_variance_
=
InputVarianceFrom
<
LoDTensor
>
(
inputs
,
scope
);
input_variance_
=
InputVarianceFrom
<
LoDTensor
>
(
inputs
,
scope
);
epsilon_
=
GetAttr
<
float
>
(
"epsilon"
,
attrs
);
epsilon_
=
GetAttr
<
float
>
(
"epsilon"
,
attrs
);
momentum_
=
GetAttr
<
float
>
(
"momentum"
,
attrs
);
momentum_
=
GetAttr
<
float
>
(
"momentum"
,
attrs
);
is_test_
=
GetAttr
<
bool
>
(
"is_test"
,
attrs
);
//
is_test_ = GetAttr<bool>("is_test", attrs);
}
}
const
Tensor
*
InputX
()
const
{
return
input_x_
;
}
const
Tensor
*
InputX
()
const
{
return
input_x_
;
}
...
...
src/operators/pool_op.cpp
浏览文件 @
74dd8366
...
@@ -54,7 +54,7 @@ void PoolOp<DeviceType, T>::InferShape() const {
...
@@ -54,7 +54,7 @@ void PoolOp<DeviceType, T>::InferShape() const {
}
}
this
->
param_
.
Output
()
->
Resize
(
framework
::
make_ddim
(
output_shape
));
this
->
param_
.
Output
()
->
Resize
(
framework
::
make_ddim
(
output_shape
));
}
}
template
class
PoolOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/prelu_op.cpp
浏览文件 @
74dd8366
...
@@ -23,7 +23,7 @@ void PReluOp<Dtype, T>::InferShape() const {
...
@@ -23,7 +23,7 @@ void PReluOp<Dtype, T>::InferShape() const {
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
}
}
template
class
PReluOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/prior_box_op.cpp
浏览文件 @
74dd8366
...
@@ -44,7 +44,7 @@ void PriorBoxOp<Dtype, T>::InferShape() const {
...
@@ -44,7 +44,7 @@ void PriorBoxOp<Dtype, T>::InferShape() const {
this
->
param_
.
OutputBoxes
()
->
Resize
(
framework
::
make_ddim
(
dim_vec
));
this
->
param_
.
OutputBoxes
()
->
Resize
(
framework
::
make_ddim
(
dim_vec
));
this
->
param_
.
OutputVariances
()
->
Resize
(
framework
::
make_ddim
(
dim_vec
));
this
->
param_
.
OutputVariances
()
->
Resize
(
framework
::
make_ddim
(
dim_vec
));
}
}
template
class
PriorBoxOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/relu_op.cpp
浏览文件 @
74dd8366
...
@@ -23,7 +23,7 @@ void ReluOp<Dtype, T>::InferShape() const {
...
@@ -23,7 +23,7 @@ void ReluOp<Dtype, T>::InferShape() const {
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
}
}
template
class
ReluOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/reshape_op.cpp
浏览文件 @
74dd8366
...
@@ -27,7 +27,7 @@ void ReshapeOp<Dtype, T>::InferShape() const {
...
@@ -27,7 +27,7 @@ void ReshapeOp<Dtype, T>::InferShape() const {
auto
out_dims
=
ValidateShape
(
shape
,
input_x_dims
);
auto
out_dims
=
ValidateShape
(
shape
,
input_x_dims
);
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
}
}
template
class
ReshapeOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/resize_op.cpp
浏览文件 @
74dd8366
...
@@ -24,7 +24,7 @@ void ResizeOp<Dtype, T>::InferShape() const {
...
@@ -24,7 +24,7 @@ void ResizeOp<Dtype, T>::InferShape() const {
auto
out_dims
=
CalOutputShape
(
this
->
param_
);
auto
out_dims
=
CalOutputShape
(
this
->
param_
);
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
}
}
template
class
ResizeOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/scale_op.cpp
浏览文件 @
74dd8366
...
@@ -24,7 +24,7 @@ void ScaleOp<Dtype, T>::InferShape() const {
...
@@ -24,7 +24,7 @@ void ScaleOp<Dtype, T>::InferShape() const {
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
auto
input_dims
=
this
->
param_
.
InputX
()
->
dims
();
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
this
->
param_
.
Out
()
->
Resize
(
input_dims
);
}
}
template
class
ScaleOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/sigmoid_op.cpp
浏览文件 @
74dd8366
...
@@ -22,7 +22,7 @@ template <typename DeviceType, typename T>
...
@@ -22,7 +22,7 @@ template <typename DeviceType, typename T>
void
SigmoidOp
<
DeviceType
,
T
>::
InferShape
()
const
{
void
SigmoidOp
<
DeviceType
,
T
>::
InferShape
()
const
{
this
->
param_
.
Out
()
->
Resize
(
this
->
param_
.
InputX
()
->
dims
());
this
->
param_
.
Out
()
->
Resize
(
this
->
param_
.
InputX
()
->
dims
());
}
}
template
class
SigmoidOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/slice_op.cpp
浏览文件 @
74dd8366
...
@@ -23,7 +23,7 @@ template <typename Dtype, typename T>
...
@@ -23,7 +23,7 @@ template <typename Dtype, typename T>
void
SliceOp
<
Dtype
,
T
>::
InferShape
()
const
{
void
SliceOp
<
Dtype
,
T
>::
InferShape
()
const
{
/// todo: add InputShape() detection.
/// todo: add InputShape() detection.
}
}
template
class
SliceOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/softmax_op.cpp
浏览文件 @
74dd8366
...
@@ -22,7 +22,7 @@ template <typename DeviceType, typename T>
...
@@ -22,7 +22,7 @@ template <typename DeviceType, typename T>
void
SoftmaxOp
<
DeviceType
,
T
>::
InferShape
()
const
{
void
SoftmaxOp
<
DeviceType
,
T
>::
InferShape
()
const
{
this
->
param_
.
Out
()
->
Resize
(
this
->
param_
.
InputX
()
->
dims
());
this
->
param_
.
Out
()
->
Resize
(
this
->
param_
.
InputX
()
->
dims
());
}
}
template
class
SoftmaxOp
<
CPU
,
float
>;
}
// namespace operators
}
// namespace operators
}
// namespace paddle_mobile
}
// namespace paddle_mobile
...
...
src/operators/transpose_op.cpp
浏览文件 @
74dd8366
...
@@ -47,7 +47,7 @@ void TransposeOp<Dtype, T>::InferShape() const {
...
@@ -47,7 +47,7 @@ void TransposeOp<Dtype, T>::InferShape() const {
}
}
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
this
->
param_
.
Out
()
->
Resize
(
out_dims
);
}
}
template
class
TransposeOp
<
CPU
,
float
>;
}
// 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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录