Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
cf963d96
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
337
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看板
提交
cf963d96
编写于
5月 24, 2018
作者:
L
liuruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format files
上级
6018d63c
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
77 addition
and
94 deletion
+77
-94
src/common/log.cpp
src/common/log.cpp
+1
-3
src/common/log.h
src/common/log.h
+1
-1
src/common/variant.cpp
src/common/variant.cpp
+0
-1
src/framework/attribute.cpp
src/framework/attribute.cpp
+7
-9
src/framework/attribute.h
src/framework/attribute.h
+7
-7
src/framework/executor.h
src/framework/executor.h
+2
-2
src/framework/framework.pb.h
src/framework/framework.pb.h
+1
-1
src/framework/operator.h
src/framework/operator.h
+8
-13
src/framework/program/block_desc.cpp
src/framework/program/block_desc.cpp
+2
-2
src/framework/program/block_desc.h
src/framework/program/block_desc.h
+4
-6
src/framework/program/op_desc.cpp
src/framework/program/op_desc.cpp
+2
-2
src/framework/program/op_desc.h
src/framework/program/op_desc.h
+6
-13
src/framework/program/program-optimize/fusion_op_register.h
src/framework/program/program-optimize/fusion_op_register.h
+4
-4
src/framework/program/program-optimize/node.cpp
src/framework/program/program-optimize/node.cpp
+2
-1
src/framework/program/program-optimize/node.h
src/framework/program/program-optimize/node.h
+3
-2
src/framework/program/program-optimize/program_optimize.cpp
src/framework/program/program-optimize/program_optimize.cpp
+1
-3
src/framework/program/program-optimize/program_optimize.h
src/framework/program/program-optimize/program_optimize.h
+1
-0
src/framework/program/program_desc.cpp
src/framework/program/program_desc.cpp
+2
-2
src/framework/program/program_desc.h
src/framework/program/program_desc.h
+3
-2
src/framework/program/var_desc.h
src/framework/program/var_desc.h
+1
-1
src/io.cpp
src/io.cpp
+4
-4
src/operators/fusion_conv_add_relu_op.h
src/operators/fusion_conv_add_relu_op.h
+10
-9
src/operators/fusion_fc_op.cpp
src/operators/fusion_fc_op.cpp
+1
-1
src/operators/fusion_fc_op.h
src/operators/fusion_fc_op.h
+4
-5
未找到文件。
src/common/log.cpp
浏览文件 @
cf963d96
...
...
@@ -14,6 +14,4 @@ limitations under the License. */
#include "log.h"
namespace
paddle_mobile
{
}
namespace
paddle_mobile
{}
src/common/log.h
浏览文件 @
cf963d96
...
...
@@ -178,4 +178,4 @@ Print &operator<<(Print &printer, const std::vector<T> &v) {
return
printer
;
}
}
// namespace paddle_mobile
\ No newline at end of file
}
// namespace paddle_mobile
src/common/variant.cpp
浏览文件 @
cf963d96
...
...
@@ -11,4 +11,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
src/framework/attribute.cpp
浏览文件 @
cf963d96
...
...
@@ -17,32 +17,30 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
framework
{
/*
* Variant<int, float, std::string, std::vector<int>, std::vector<float>,
std::vector<std::string>, bool, std::vector<bool>, BlockDesc *,
int64_t>
* */
struct
PrintVistor
:
Vistor
<
Print
&>
{
PrintVistor
(
Print
&
printer
)
:
printer_
(
printer
){
}
struct
PrintVistor
:
Vistor
<
Print
&>
{
PrintVistor
(
Print
&
printer
)
:
printer_
(
printer
)
{}
template
<
typename
T
>
Print
&
operator
()(
const
T
&
value
){
Print
&
operator
()(
const
T
&
value
)
{
printer_
<<
value
;
return
printer_
;
}
private:
Print
&
printer_
;
};
Print
&
operator
<<
(
Print
&
printer
,
const
Attribute
&
attr
)
{
Attribute
::
ApplyVistor
(
PrintVistor
(
printer
),
attr
);
// std::vector<std::string> v = {"1", "2"};
// printer << (v);
// std::vector<std::string> v = {"1", "2"};
// printer << (v);
return
printer
;
}
}
}
// namespace framework
}
// namespace paddle_mobile
src/framework/attribute.h
浏览文件 @
cf963d96
...
...
@@ -111,15 +111,18 @@ class Attribute {
return
vistor
(
attr
.
variant_
.
Get
<
std
::
string
>
());
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
int
>
).
hash_code
())
{
return
vistor
(
attr
.
variant_
.
Get
<
std
::
vector
<
int
>>
());
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
float
>
).
hash_code
())
{
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
float
>
).
hash_code
())
{
return
vistor
(
attr
.
variant_
.
Get
<
std
::
vector
<
float
>>
());
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
std
::
string
>
).
hash_code
())
{
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
std
::
string
>
).
hash_code
())
{
return
vistor
(
attr
.
variant_
.
Get
<
std
::
vector
<
std
::
string
>>
());
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
bool
).
hash_code
())
{
return
vistor
(
attr
.
variant_
.
Get
<
bool
>
());
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
bool
>
).
hash_code
())
{
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
std
::
vector
<
bool
>
).
hash_code
())
{
return
vistor
(
attr
.
variant_
.
Get
<
std
::
vector
<
bool
>>
());
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
int64_t
).
hash_code
())
{
}
else
if
(
attr
.
variant_
.
TypeId
()
==
typeid
(
int64_t
).
hash_code
())
{
return
vistor
(
attr
.
variant_
.
Get
<
int64_t
>
());
}
else
{
throw
std
::
bad_exception
();
...
...
@@ -152,9 +155,6 @@ class AttrReader {
const
AttributeMap
&
attrs_
;
};
Print
&
operator
<<
(
Print
&
printer
,
const
Attribute
&
op_desc
);
}
// namespace framework
...
...
src/framework/executor.h
浏览文件 @
cf963d96
...
...
@@ -18,11 +18,11 @@ limitations under the License. */
#include <string>
#include <vector>
#include "framework/program/block_desc.h"
#include "framework.pb.h"
#include "
operator
.h"
#include "
framework/program/block_desc
.h"
#include "framework/program/program.h"
#include "framework/program/program_desc.h"
#include "operator.h"
#include "scope.h"
#include "tensor.h"
#include "variable.h"
...
...
src/framework/framework.pb.h
浏览文件 @
cf963d96
...
...
@@ -124,7 +124,7 @@ void AddDescriptors();
void
InitDefaults
();
}
// namespace protobuf_framework_2eproto
enum
VarType_Type
{
enum
VarType_Type
{
VarType_Type_BOOL
=
0
,
VarType_Type_INT16
=
1
,
VarType_Type_INT32
=
2
,
...
...
src/framework/operator.h
浏览文件 @
cf963d96
...
...
@@ -22,15 +22,15 @@ limitations under the License. */
#include "common/type_define.h"
#include "common/types.h"
#include "common/variant.h"
#include "framework/scope.h"
#include "framework/tensor.h"
#include "framework/op_info.h"
#include "framework/variable.h"
#include "framework/attribute.h"
#include "framework/op_info.h"
#include "framework/op_kernel_type.h"
#include "framework/program/block_desc.h"
#include "framework/paddle_mobile_object.h"
#include "framework/program/block_desc.h"
#include "framework/program/program-optimize/node.h"
#include "framework/scope.h"
#include "framework/tensor.h"
#include "framework/variable.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
@@ -104,7 +104,7 @@ class OpKernelBase : PaddleMobileObject {
std::shared_ptr<::paddle_mobile::framework::Scope> scope) \
: parent_cls<Dtype, T>(type, inputs, outputs, attrs, scope) {}
class
FusionOpMatcher
:
PaddleMobileObject
{
class
FusionOpMatcher
:
PaddleMobileObject
{
public:
FusionOpMatcher
()
{}
...
...
@@ -112,16 +112,11 @@ class FusionOpMatcher: PaddleMobileObject{
virtual
void
FolderNodes
(
Node
&
node
)
{
node
.
Folder
(
node_
.
Depth
(),
Type
(),
{});
}
virtual
Node
&
BeginNode
()
{
return
node_
;
}
virtual
Node
&
BeginNode
()
{
return
node_
;
}
std
::
string
BeginType
()
{
return
node_
.
BeginType
();
}
std
::
string
BeginType
()
{
return
node_
.
BeginType
();
}
protected:
Node
node_
;
...
...
src/framework/program/block_desc.cpp
浏览文件 @
cf963d96
...
...
@@ -33,8 +33,8 @@ std::vector<std::shared_ptr<OpDesc>> BlockDesc::Ops() const {
return
res
;
}
BlockDesc
::
BlockDesc
(
const
proto
::
BlockDesc
&
desc
)
:
index_
(
desc
.
idx
()),
parent_index_
(
desc
.
parent_idx
())
{
BlockDesc
::
BlockDesc
(
const
proto
::
BlockDesc
&
desc
)
:
index_
(
desc
.
idx
()),
parent_index_
(
desc
.
parent_idx
())
{
for
(
const
proto
::
VarDesc
&
var_desc
:
desc
.
vars
())
{
vars_
[
var_desc
.
name
()].
reset
(
new
VarDesc
(
var_desc
));
}
...
...
src/framework/program/block_desc.h
浏览文件 @
cf963d96
...
...
@@ -15,10 +15,9 @@ limitations under the License. */
#pragma once
#include "framework/framework.pb.h"
#include "framework/paddle_mobile_object.h"
#include "framework/program/op_desc.h"
#include "framework/program/var_desc.h"
#include "framework/paddle_mobile_object.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
@@ -29,9 +28,8 @@ class BlockDesc : PaddleMobileObject {
friend
class
ProgramOptimize
;
BlockDesc
(
const
proto
::
BlockDesc
&
desc
);
BlockDesc
(
const
BlockDesc
&
block_desc
)
:
index_
(
block_desc
.
index_
),
parent_index_
(
block_desc
.
parent_index_
)
{
BlockDesc
(
const
BlockDesc
&
block_desc
)
:
index_
(
block_desc
.
index_
),
parent_index_
(
block_desc
.
parent_index_
)
{
for
(
auto
&
op_desc
:
block_desc
.
ops_
)
{
std
::
shared_ptr
<
OpDesc
>
copy_op_desc
=
std
::
make_shared
<
OpDesc
>
(
*
op_desc
);
ops_
.
push_back
(
copy_op_desc
);
...
...
@@ -39,7 +37,7 @@ class BlockDesc : PaddleMobileObject {
for
(
auto
&
var_desc
:
block_desc
.
vars_
)
{
std
::
shared_ptr
<
VarDesc
>
copy_var_desc
=
std
::
make_shared
<
VarDesc
>
(
*
var_desc
.
second
);
std
::
make_shared
<
VarDesc
>
(
*
var_desc
.
second
);
vars_
[
var_desc
.
first
]
=
copy_var_desc
;
}
}
...
...
src/framework/program/op_desc.cpp
浏览文件 @
cf963d96
...
...
@@ -20,7 +20,7 @@ limitations under the License. */
namespace
paddle_mobile
{
namespace
framework
{
OpDesc
::
OpDesc
(
const
proto
::
OpDesc
&
desc
)
:
type_
(
desc
.
type
())
{
OpDesc
::
OpDesc
(
const
proto
::
OpDesc
&
desc
)
:
type_
(
desc
.
type
())
{
for
(
int
i
=
0
;
i
<
desc
.
inputs_size
();
++
i
)
{
const
proto
::
OpDesc
::
Var
&
var
=
desc
.
inputs
(
i
);
std
::
vector
<
std
::
string
>
&
args
=
inputs_
[
var
.
parameter
()];
...
...
@@ -65,7 +65,7 @@ std::unordered_map<std::string, Attribute> &OpDesc::GetAttrMap() {
}
Print
&
operator
<<
(
Print
&
printer
,
const
OpDesc
&
op_desc
)
{
OpDesc
&
no_const_op_desc
=
const_cast
<
OpDesc
&>
(
op_desc
);
OpDesc
&
no_const_op_desc
=
const_cast
<
OpDesc
&>
(
op_desc
);
printer
<<
"inputs:
\n
"
;
for
(
const
auto
&
input
:
no_const_op_desc
.
GetInputs
())
{
printer
<<
input
.
first
<<
" : "
<<
input
.
second
<<
"
\n
"
;
...
...
src/framework/program/op_desc.h
浏览文件 @
cf963d96
...
...
@@ -14,8 +14,8 @@ limitations under the License. */
#pragma once
#include <vector>
#include <string>
#include <vector>
#include "common/log.h"
#include "common/type_define.h"
...
...
@@ -32,14 +32,13 @@ class OpDesc : PaddleMobileObject {
friend
class
Node
;
explicit
OpDesc
(
const
proto
::
OpDesc
&
desc
);
OpDesc
(
const
OpDesc
&
op_desc
)
:
type_
(
op_desc
.
type_
)
{
OpDesc
(
const
OpDesc
&
op_desc
)
:
type_
(
op_desc
.
type_
)
{
this
->
inputs_
=
op_desc
.
inputs_
;
this
->
outputs_
=
op_desc
.
outputs_
;
this
->
attrs_
=
op_desc
.
attrs_
;
}
OpDesc
()
{
}
OpDesc
()
{}
const
std
::
vector
<
std
::
string
>
&
Input
(
const
std
::
string
&
name
)
const
;
const
std
::
vector
<
std
::
string
>
&
Output
(
const
std
::
string
&
name
)
const
;
Attribute
GetAttr
(
const
std
::
string
&
name
)
const
;
...
...
@@ -52,17 +51,11 @@ class OpDesc : PaddleMobileObject {
const
std
::
string
&
Type
()
{
return
type_
;
}
void
SetInputs
(
VariableNameMap
inputs
){
inputs_
=
inputs
;
}
void
SetInputs
(
VariableNameMap
inputs
)
{
inputs_
=
inputs
;
}
void
SetOutputs
(
VariableNameMap
outputs
){
outputs_
=
outputs
;
}
void
SetOutputs
(
VariableNameMap
outputs
)
{
outputs_
=
outputs
;
}
void
SetAttrMap
(
AttributeMap
attrs
){
attrs_
=
attrs
;
}
void
SetAttrMap
(
AttributeMap
attrs
)
{
attrs_
=
attrs
;
}
private:
std
::
string
type_
;
...
...
src/framework/program/program-optimize/fusion_op_register.h
浏览文件 @
cf963d96
...
...
@@ -25,8 +25,8 @@ namespace framework {
class
FusionOpRegister
{
public:
static
FusionOpRegister
*
Instance
()
{
static
FusionOpRegister
*
regist
=
nullptr
;
static
FusionOpRegister
*
Instance
()
{
static
FusionOpRegister
*
regist
=
nullptr
;
if
(
regist
==
nullptr
)
{
regist
=
new
FusionOpRegister
();
}
...
...
@@ -47,9 +47,9 @@ class FusionOpRegister {
FusionOpRegister
()
{}
};
class
FusionOpRegistrar
{
class
FusionOpRegistrar
{
public:
explicit
FusionOpRegistrar
(
FusionOpMatcher
*
matcher
){
explicit
FusionOpRegistrar
(
FusionOpMatcher
*
matcher
)
{
FusionOpRegister
::
Instance
()
->
regist
(
matcher
);
}
};
...
...
src/framework/program/program-optimize/node.cpp
浏览文件 @
cf963d96
...
...
@@ -72,7 +72,8 @@ void Node::OpDescs(uint index,
}
}
void
Node
::
OpDescs
(
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
*
op_desc
,
Node
*
node
)
{
void
Node
::
OpDescs
(
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
*
op_desc
,
Node
*
node
)
{
auto
iter
=
std
::
find
(
op_desc
->
begin
(),
op_desc
->
end
(),
this
->
op_desc_
);
if
(
inputs_
.
size
()
>
1
&&
node
!=
inputs_
.
back
())
{
return
;
...
...
src/framework/program/program-optimize/node.h
浏览文件 @
cf963d96
...
...
@@ -20,8 +20,8 @@ limitations under the License. */
#include <vector>
#include "common/log.h"
#include "framework/program/op_desc.h"
#include "framework/paddle_mobile_object.h"
#include "framework/program/op_desc.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
@@ -42,7 +42,8 @@ class Node : PaddleMobileObject {
std
::
map
<
std
::
string
,
std
::
pair
<
std
::
string
,
std
::
string
>>
change_map
);
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
OpDescs
(
uint
size
);
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
OpDescs
();
void
OpDescs
(
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
*
op_desc
,
Node
*
node
);
void
OpDescs
(
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
*
op_desc
,
Node
*
node
);
std
::
shared_ptr
<
framework
::
OpDesc
>
OpDesc
()
{
return
op_desc_
;
}
std
::
string
BeginType
()
{
return
type_
;
}
void
Description
();
...
...
src/framework/program/program-optimize/program_optimize.cpp
浏览文件 @
cf963d96
...
...
@@ -23,7 +23,6 @@ std::shared_ptr<ProgramDesc> ProgramOptimize::Optimize() {}
std
::
shared_ptr
<
ProgramDesc
>
ProgramOptimize
::
FushionOptimize
(
std
::
shared_ptr
<
ProgramDesc
>
ori_des
)
{
ProgramDesc
*
optimize_program
=
new
ProgramDesc
(
*
ori_des
);
for
(
int
i
=
0
;
i
<
optimize_program
->
Blocks
().
size
();
++
i
)
{
...
...
@@ -96,9 +95,8 @@ std::shared_ptr<ProgramDesc> ProgramOptimize::FushionOptimize(
}
}
// DLOG << "node: \n" << *begin_node;
// DLOG << "node: \n" << *begin_node;
block
->
ops_
=
begin_node
->
OpDescs
();
}
std
::
shared_ptr
<
ProgramDesc
>
shared_optimzie
(
optimize_program
);
return
shared_optimzie
;
...
...
src/framework/program/program-optimize/program_optimize.h
浏览文件 @
cf963d96
...
...
@@ -30,6 +30,7 @@ class ProgramOptimize {
std
::
shared_ptr
<
ProgramDesc
>
Optimize
();
std
::
shared_ptr
<
ProgramDesc
>
FushionOptimize
(
std
::
shared_ptr
<
ProgramDesc
>
ori_des
);
private:
// std::shared_ptr<ProgramDesc> ori_desc_;
std
::
vector
<
std
::
unordered_map
<
std
::
string
,
std
::
shared_ptr
<
Node
>>>
...
...
src/framework/program/program_desc.cpp
浏览文件 @
cf963d96
...
...
@@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <vector>
#include <string>
#include <vector>
#include "program_desc.h"
...
...
@@ -29,7 +29,7 @@ ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) {
void
ProgramDesc
::
Description
(
std
::
string
header
)
{
#ifdef PADDLE_MOBILE_DEBUG
if
(
header
.
size
()){
if
(
header
.
size
())
{
LOG
(
kLOG_INFO
)
<<
header
;
}
for
(
const
auto
&
block
:
this
->
blocks_
)
{
...
...
src/framework/program/program_desc.h
浏览文件 @
cf963d96
...
...
@@ -17,8 +17,8 @@ limitations under the License. */
#include <vector>
#include "common/types.h"
#include "framework/program/block_desc.h"
#include "framework/paddle_mobile_object.h"
#include "framework/program/block_desc.h"
namespace
paddle_mobile
{
namespace
framework
{
...
...
@@ -33,12 +33,13 @@ class ProgramDesc : PaddleMobileObject {
ProgramDesc
(
const
ProgramDesc
&
program_desc
)
{
for
(
auto
&
block
:
program_desc
.
blocks_
)
{
std
::
shared_ptr
<
BlockDesc
>
copy_block
=
std
::
make_shared
<
BlockDesc
>
(
*
block
);
std
::
make_shared
<
BlockDesc
>
(
*
block
);
blocks_
.
push_back
(
copy_block
);
}
}
void
Description
(
std
::
string
header
=
""
);
private:
std
::
vector
<
std
::
shared_ptr
<
BlockDesc
>>
blocks_
;
};
...
...
src/framework/program/var_desc.h
浏览文件 @
cf963d96
...
...
@@ -24,7 +24,7 @@ class VarDesc {
public:
VarDesc
(
const
proto
::
VarDesc
&
desc
);
VarDesc
(
const
VarDesc
&
var_desc
)
:
desc_
(
var_desc
.
desc_
)
{}
VarDesc
(
const
VarDesc
&
var_desc
)
:
desc_
(
var_desc
.
desc_
)
{}
std
::
string
Name
()
const
{
return
desc_
.
name
();
}
...
...
src/io.cpp
浏览文件 @
cf963d96
...
...
@@ -14,13 +14,13 @@ limitations under the License. */
#include <fstream>
#include "io.h"
#include "common/log.h"
#include "framework/scope.h"
#include "framework/tensor.h"
#include "framework/lod_tensor.h"
#include "framework/framework.pb.h"
#include "framework/lod_tensor.h"
#include "framework/program/program_desc.h"
#include "framework/scope.h"
#include "framework/tensor.h"
#include "io.h"
namespace
paddle_mobile
{
...
...
src/operators/fusion_conv_add_relu_op.h
浏览文件 @
cf963d96
...
...
@@ -24,17 +24,17 @@ class FushionConvAddReluOpMatcher : public framework::FusionOpMatcher {
public:
FushionConvAddReluOpMatcher
()
{
node_
=
framework
::
Node
(
"conv2d"
);
node_
>
std
::
make_shared
<
framework
::
Node
>
(
"elementwise_add"
)
>
std
::
make_shared
<
framework
::
Node
>
(
"relu"
);
node_
>
std
::
make_shared
<
framework
::
Node
>
(
"elementwise_add"
)
>
std
::
make_shared
<
framework
::
Node
>
(
"relu"
);
}
void
FolderNodes
(
framework
::
Node
&
node
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
.
OpDescs
(
node_
.
Depth
());
node
.
Folder
(
node_
.
Depth
(),
Type
(),
{{
"elementwise_add"
,
{
"Y"
,
"Z"
}}});
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
.
OpDescs
(
node_
.
Depth
());
node
.
Folder
(
node_
.
Depth
(),
Type
(),
{{
"elementwise_add"
,
{
"Y"
,
"Z"
}}});
}
std
::
string
Type
()
{
return
"FusionConvAddRelu"
;
}
std
::
string
Type
()
{
return
"FusionConvAddRelu"
;
}
};
class
FusionFcOp
{
...
...
@@ -42,7 +42,8 @@ class FusionFcOp {
private:
};
static
framework
::
FusionOpRegistrar
fc_registrar
(
new
FushionConvAddReluOpMatcher
());
static
framework
::
FusionOpRegistrar
fc_registrar
(
new
FushionConvAddReluOpMatcher
());
}
}
}
// namespace operators
}
// namespace paddle_mobile
src/operators/fusion_fc_op.cpp
浏览文件 @
cf963d96
...
...
@@ -12,4 +12,4 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include "fusion_fc_op.h"
\ No newline at end of file
#include "fusion_fc_op.h"
src/operators/fusion_fc_op.h
浏览文件 @
cf963d96
...
...
@@ -30,13 +30,12 @@ class FusionFcMatcher : public framework::FusionOpMatcher {
}
void
FolderNodes
(
framework
::
Node
&
node
)
{
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
.
OpDescs
(
node_
.
Depth
());
node
.
Folder
(
node_
.
Depth
(),
Type
(),
{{
"elementwise_add"
,
{
"Y"
,
"Z"
}}});
std
::
vector
<
std
::
shared_ptr
<
framework
::
OpDesc
>>
origin_descs
=
node
.
OpDescs
(
node_
.
Depth
());
node
.
Folder
(
node_
.
Depth
(),
Type
(),
{{
"elementwise_add"
,
{
"Y"
,
"Z"
}}});
}
std
::
string
Type
()
{
return
"fc"
;
}
std
::
string
Type
()
{
return
"fc"
;
}
};
class
FusionFcOp
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录