Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
50ab1dd6
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看板
提交
50ab1dd6
编写于
1月 23, 2019
作者:
Z
zhaojiaying01
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
merge logical op param
上级
27459ab1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
55 addition
and
74 deletion
+55
-74
src/common/types.h
src/common/types.h
+7
-0
src/framework/load_ops.h
src/framework/load_ops.h
+18
-0
src/operators/kernel/arm/logical_kernel.cpp
src/operators/kernel/arm/logical_kernel.cpp
+12
-8
src/operators/kernel/logical_kernel.h
src/operators/kernel/logical_kernel.h
+4
-4
src/operators/logical_op.h
src/operators/logical_op.h
+4
-4
src/operators/op_param.h
src/operators/op_param.h
+10
-58
未找到文件。
src/common/types.h
浏览文件 @
50ab1dd6
...
...
@@ -131,9 +131,12 @@ extern const char *G_OP_TYPE_FUSION_CONV_BN_ADD_RELU;
extern
const
char
*
G_OP_TYPE_FUSION_DWCONV_BN_RELU
;
extern
const
char
*
G_OP_TYPE_FUSION_CONV_BN_RELU
;
extern
const
char
*
G_OP_TYPE_GRU
;
extern
const
char
*
G_OP_TYPE_GRU_UNIT
;
extern
const
char
*
G_OP_TYPE_LRN
;
extern
const
char
*
G_OP_TYPE_MUL
;
extern
const
char
*
G_OP_TYPE_MULTICLASS_NMS
;
extern
const
char
*
G_OP_TYPE_NORM
;
extern
const
char
*
G_OP_TYPE_POOL2D
;
extern
const
char
*
G_OP_TYPE_PRIOR_BOX
;
extern
const
char
*
G_OP_TYPE_RELU
;
...
...
@@ -163,6 +166,10 @@ extern const char *G_OP_TYPE_CAST;
extern
const
char
*
G_OP_TYPE_LOG
;
extern
const
char
*
G_OP_TYPE_LOD_RESET
;
extern
const
char
*
G_OP_TYPE_LESS_THAN
;
extern
const
char
*
G_OP_TYPE_LOGICAL_AND
;
extern
const
char
*
G_OP_TYPE_LOGICAL_OR
;
extern
const
char
*
G_OP_TYPE_LOGICAL_NOT
;
extern
const
char
*
G_OP_TYPE_LOGICAL_XOR
;
extern
const
char
*
G_OP_TYPE_QUANTIZE
;
extern
const
char
*
G_OP_TYPE_DEQUANTIZE
;
...
...
src/framework/load_ops.h
浏览文件 @
50ab1dd6
...
...
@@ -168,6 +168,9 @@ LOAD_FUSION_MATCHER(fusion_conv_bn_relu);
#ifdef GRU_OP
LOAD_OP1
(
gru
,
CPU
);
#endif
#ifdef GRU_UNIT_OP
LOAD_OP1
(
gru_unit
,
CPU
);
#endif
#ifdef FUSION_CONVADDBN_OP
LOAD_OP2
(
fusion_conv_add_bn
,
CPU
,
FPGA
);
LOAD_FUSION_MATCHER
(
fusion_conv_add_bn
);
...
...
@@ -189,6 +192,9 @@ LOAD_OP1(crf_decoding, CPU);
#ifdef MUL_OP
LOAD_OP2
(
mul
,
CPU
,
MALI_GPU
);
#endif
#ifdef NORM_OP
LOAD_OP1
(
norm
,
CPU
);
#endif
#ifdef RELU_OP
LOAD_OP2
(
relu
,
CPU
,
MALI_GPU
);
LOAD_OP1
(
relu6
,
CPU
);
...
...
@@ -279,3 +285,15 @@ LOAD_OP1(lod_reset, CPU);
#ifdef LESS_THAN_OP
LOAD_OP1
(
less_than
,
CPU
);
#endif
#ifdef LOGICAL_AND_OP
LOAD_OP1
(
logical_and
,
CPU
);
#endif
#ifdef LOGICAL_OR_OP
LOAD_OP1
(
logical_or
,
CPU
);
#endif
#ifdef LOGICAL_NOT_OP
LOAD_OP1
(
logical_not
,
CPU
);
#endif
#ifdef LOGICAL_XOR_OP
LOAD_OP1
(
logical_xor
,
CPU
);
#endif
src/operators/kernel/arm/logical_kernel.cpp
浏览文件 @
50ab1dd6
...
...
@@ -56,12 +56,13 @@ void BinaryLogicalCompute(const Tensor* inputX, const Tensor* inputY,
#ifdef LOGICAL_AND_OP
template
<
>
bool
LogicalAndKernel
<
CPU
,
float
>::
Init
(
Logical
And
Param
<
CPU
>*
param
)
{
bool
LogicalAndKernel
<
CPU
,
float
>::
Init
(
Logical
Binary
Param
<
CPU
>*
param
)
{
return
true
;
}
template
<
>
void
LogicalAndKernel
<
CPU
,
float
>::
Compute
(
const
LogicalAndParam
<
CPU
>&
param
)
{
void
LogicalAndKernel
<
CPU
,
float
>::
Compute
(
const
LogicalBinaryParam
<
CPU
>&
param
)
{
auto
*
inputX
=
param
.
InputX
();
auto
*
inputY
=
param
.
InputY
();
auto
*
out
=
param
.
Out
();
...
...
@@ -72,12 +73,13 @@ void LogicalAndKernel<CPU, float>::Compute(const LogicalAndParam<CPU>& param) {
#ifdef LOGICAL_OR_OP
template
<
>
bool
LogicalOrKernel
<
CPU
,
float
>::
Init
(
Logical
Or
Param
<
CPU
>*
param
)
{
bool
LogicalOrKernel
<
CPU
,
float
>::
Init
(
Logical
Binary
Param
<
CPU
>*
param
)
{
return
true
;
}
template
<
>
void
LogicalOrKernel
<
CPU
,
float
>::
Compute
(
const
LogicalOrParam
<
CPU
>&
param
)
{
void
LogicalOrKernel
<
CPU
,
float
>::
Compute
(
const
LogicalBinaryParam
<
CPU
>&
param
)
{
auto
*
inputX
=
param
.
InputX
();
auto
*
inputY
=
param
.
InputY
();
auto
*
out
=
param
.
Out
();
...
...
@@ -88,12 +90,13 @@ void LogicalOrKernel<CPU, float>::Compute(const LogicalOrParam<CPU>& param) {
#ifdef LOGICAL_NOT_OP
template
<
>
bool
LogicalNotKernel
<
CPU
,
float
>::
Init
(
Logical
Not
Param
<
CPU
>*
param
)
{
bool
LogicalNotKernel
<
CPU
,
float
>::
Init
(
Logical
Unary
Param
<
CPU
>*
param
)
{
return
true
;
}
template
<
>
void
LogicalNotKernel
<
CPU
,
float
>::
Compute
(
const
LogicalNotParam
<
CPU
>&
param
)
{
void
LogicalNotKernel
<
CPU
,
float
>::
Compute
(
const
LogicalUnaryParam
<
CPU
>&
param
)
{
auto
*
inputX
=
param
.
InputX
();
auto
*
out
=
param
.
Out
();
out
->
mutable_data
<
bool
>
();
...
...
@@ -103,12 +106,13 @@ void LogicalNotKernel<CPU, float>::Compute(const LogicalNotParam<CPU>& param) {
#ifdef LOGICAL_XOR_OP
template
<
>
bool
LogicalXorKernel
<
CPU
,
float
>::
Init
(
Logical
Xor
Param
<
CPU
>*
param
)
{
bool
LogicalXorKernel
<
CPU
,
float
>::
Init
(
Logical
Binary
Param
<
CPU
>*
param
)
{
return
true
;
}
template
<
>
void
LogicalXorKernel
<
CPU
,
float
>::
Compute
(
const
LogicalXorParam
<
CPU
>&
param
)
{
void
LogicalXorKernel
<
CPU
,
float
>::
Compute
(
const
LogicalBinaryParam
<
CPU
>&
param
)
{
auto
*
inputX
=
param
.
InputX
();
auto
*
inputY
=
param
.
InputY
();
auto
*
out
=
param
.
Out
();
...
...
src/operators/kernel/logical_kernel.h
浏览文件 @
50ab1dd6
...
...
@@ -21,19 +21,19 @@ namespace paddle_mobile {
namespace
operators
{
#ifdef LOGICAL_AND_OP
DECLARE_KERNEL
(
LogicalAnd
,
Logical
And
Param
);
DECLARE_KERNEL
(
LogicalAnd
,
Logical
Binary
Param
);
#endif
#ifdef LOGICAL_OR_OP
DECLARE_KERNEL
(
LogicalOr
,
Logical
Or
Param
);
DECLARE_KERNEL
(
LogicalOr
,
Logical
Binary
Param
);
#endif
#ifdef LOGICAL_NOT_OP
DECLARE_KERNEL
(
LogicalNot
,
Logical
Not
Param
);
DECLARE_KERNEL
(
LogicalNot
,
Logical
Unary
Param
);
#endif
#ifdef LOGICAL_XOR_OP
DECLARE_KERNEL
(
LogicalXor
,
Logical
Xor
Param
);
DECLARE_KERNEL
(
LogicalXor
,
Logical
Binary
Param
);
#endif
}
// namespace operators
...
...
src/operators/logical_op.h
浏览文件 @
50ab1dd6
...
...
@@ -23,19 +23,19 @@ namespace paddle_mobile {
namespace
operators
{
#ifdef LOGICAL_AND_OP
DECLARE_OPERATOR
(
LogicalAnd
,
Logical
And
Param
,
LogicalAndKernel
);
DECLARE_OPERATOR
(
LogicalAnd
,
Logical
Binary
Param
,
LogicalAndKernel
);
#endif
#ifdef LOGICAL_OR_OP
DECLARE_OPERATOR
(
LogicalOr
,
Logical
Or
Param
,
LogicalOrKernel
);
DECLARE_OPERATOR
(
LogicalOr
,
Logical
Binary
Param
,
LogicalOrKernel
);
#endif
#ifdef LOGICAL_NOT_OP
DECLARE_OPERATOR
(
LogicalNot
,
Logical
Not
Param
,
LogicalNotKernel
);
DECLARE_OPERATOR
(
LogicalNot
,
Logical
Unary
Param
,
LogicalNotKernel
);
#endif
#ifdef LOGICAL_XOR_OP
DECLARE_OPERATOR
(
LogicalXor
,
Logical
Xor
Param
,
LogicalXorKernel
);
DECLARE_OPERATOR
(
LogicalXor
,
Logical
Binary
Param
,
LogicalXorKernel
);
#endif
}
// namespace operators
...
...
src/operators/op_param.h
浏览文件 @
50ab1dd6
...
...
@@ -2942,40 +2942,16 @@ class CompareParam : public OpParam {
};
#endif // LESS_THAN_OP
#if
def LOGICAL_AND_OP
#if
defined(LOGICAL_AND_OP) || defined(LOGICAL_OR_OP) || defined(LOGICAL_XOR_OP)
template
<
typename
Dtype
>
class
Logical
And
Param
:
public
OpParam
{
class
Logical
Binary
Param
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
typedef
typename
DtypeTensorTrait
<
Dtype
>::
rtype
RType
;
public:
LogicalAndParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
InputXFrom
<
GType
>
(
inputs
,
scope
);
input_y_
=
InputYFrom
<
GType
>
(
inputs
,
scope
);
output_
=
OutFrom
<
GType
>
(
outputs
,
scope
);
}
const
GType
*
InputX
()
const
{
return
input_x_
;
}
const
GType
*
InputY
()
const
{
return
input_y_
;
}
GType
*
Out
()
const
{
return
output_
;
}
public:
GType
*
input_x_
;
GType
*
input_y_
;
GType
*
output_
;
};
#endif // LOGICAL_AND_OP
#ifdef LOGICAL_OR_OP
template
<
typename
Dtype
>
class
LogicalOrParam
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
typedef
typename
DtypeTensorTrait
<
Dtype
>::
rtype
RType
;
public:
LogicalOrParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
LogicalBinaryParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
InputXFrom
<
GType
>
(
inputs
,
scope
);
input_y_
=
InputYFrom
<
GType
>
(
inputs
,
scope
);
output_
=
OutFrom
<
GType
>
(
outputs
,
scope
);
...
...
@@ -2990,17 +2966,18 @@ class LogicalOrParam : public OpParam {
GType
*
input_y_
;
GType
*
output_
;
};
#endif // LOGICAL_OR_OP
#endif // LOGICAL_
AND_OP LOGICAL_OR_OP LOGICAL_X
OR_OP
#ifdef LOGICAL_NOT_OP
template
<
typename
Dtype
>
class
Logical
Not
Param
:
public
OpParam
{
class
Logical
Unary
Param
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
typedef
typename
DtypeTensorTrait
<
Dtype
>::
rtype
RType
;
public:
LogicalNotParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
LogicalUnaryParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
InputXFrom
<
GType
>
(
inputs
,
scope
);
output_
=
OutFrom
<
GType
>
(
outputs
,
scope
);
}
...
...
@@ -3014,30 +2991,5 @@ class LogicalNotParam : public OpParam {
};
#endif // LOGICAL_NOT_OP
#ifdef LOGICAL_XOR_OP
template
<
typename
Dtype
>
class
LogicalXorParam
:
public
OpParam
{
typedef
typename
DtypeTensorTrait
<
Dtype
>::
gtype
GType
;
typedef
typename
DtypeTensorTrait
<
Dtype
>::
rtype
RType
;
public:
LogicalXorParam
(
const
VariableNameMap
&
inputs
,
const
VariableNameMap
&
outputs
,
const
AttributeMap
&
attrs
,
const
Scope
&
scope
)
{
input_x_
=
InputXFrom
<
GType
>
(
inputs
,
scope
);
input_y_
=
InputYFrom
<
GType
>
(
inputs
,
scope
);
output_
=
OutFrom
<
GType
>
(
outputs
,
scope
);
}
const
GType
*
InputX
()
const
{
return
input_x_
;
}
const
GType
*
InputY
()
const
{
return
input_y_
;
}
GType
*
Out
()
const
{
return
output_
;
}
public:
GType
*
input_x_
;
GType
*
input_y_
;
GType
*
output_
;
};
#endif // LOGICAL_XOR_OP
}
// namespace operators
}
// namespace paddle_mobile
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录