Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
c161f967
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c161f967
编写于
5月 29, 2019
作者:
L
liuwei1031
提交者:
GitHub
5月 29, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compilation issue (#17725)
上级
adba6b83
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
35 addition
and
19 deletion
+35
-19
paddle/fluid/lite/operators/CMakeLists.txt
paddle/fluid/lite/operators/CMakeLists.txt
+1
-1
paddle/fluid/lite/operators/activation_ops.cc
paddle/fluid/lite/operators/activation_ops.cc
+6
-0
paddle/fluid/lite/operators/elementwise_ops.cc
paddle/fluid/lite/operators/elementwise_ops.cc
+5
-2
paddle/fluid/lite/operators/fill_constant_op.cc
paddle/fluid/lite/operators/fill_constant_op.cc
+4
-6
paddle/fluid/lite/operators/mean_op.cc
paddle/fluid/lite/operators/mean_op.cc
+6
-1
paddle/fluid/lite/operators/mul_op.cc
paddle/fluid/lite/operators/mul_op.cc
+13
-9
未找到文件。
paddle/fluid/lite/operators/CMakeLists.txt
浏览文件 @
c161f967
...
@@ -12,7 +12,7 @@ cc_library(activation_ops_lite SRCS activation_ops.cc DEPS ${op_DEPS})
...
@@ -12,7 +12,7 @@ cc_library(activation_ops_lite SRCS activation_ops.cc DEPS ${op_DEPS})
cc_library
(
elementwise_ops_lite SRCS elementwise_ops.cc DEPS
${
op_DEPS
}
)
cc_library
(
elementwise_ops_lite SRCS elementwise_ops.cc DEPS
${
op_DEPS
}
)
cc_library
(
mean_op_lite SRCS mean_op.cc DEPS
${
op_DEPS
}
)
cc_library
(
mean_op_lite SRCS mean_op.cc DEPS
${
op_DEPS
}
)
cc_library
(
fill_constant_op_lite SRCS fill_constant_op.cc DEPS
${
op_DEPS
}
)
cc_library
(
fill_constant_op_lite SRCS fill_constant_op.cc DEPS
${
op_DEPS
}
)
cc_library
(
sgd_op_lite SRCS sgd_op.cc DEPS
${
op_DEPS
}
)
#
cc_library(sgd_op_lite SRCS sgd_op.cc DEPS ${op_DEPS})
cc_library
(
op_params_lite SRCS op_params.cc DEPS
${
tensor_lite
}
any_lite framework_proto_lite
)
cc_library
(
op_params_lite SRCS op_params.cc DEPS
${
tensor_lite
}
any_lite framework_proto_lite
)
set
(
ops_lite
set
(
ops_lite
...
...
paddle/fluid/lite/operators/activation_ops.cc
浏览文件 @
c161f967
...
@@ -12,7 +12,9 @@
...
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#ifdef LITE_WITH_X86
#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/framework/operator.h"
#endif
#include "paddle/fluid/lite/core/op_lite.h"
#include "paddle/fluid/lite/core/op_lite.h"
#include "paddle/fluid/lite/core/op_registry.h"
#include "paddle/fluid/lite/core/op_registry.h"
...
@@ -48,6 +50,7 @@ class ActivationOp : public OpLite {
...
@@ -48,6 +50,7 @@ class ActivationOp : public OpLite {
mutable
ActivationParam
param_
;
mutable
ActivationParam
param_
;
};
};
#ifdef LITE_WITH_X86
class
ActivationGradOp
:
public
OpLite
{
class
ActivationGradOp
:
public
OpLite
{
public:
public:
explicit
ActivationGradOp
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
explicit
ActivationGradOp
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
...
@@ -79,10 +82,13 @@ class ActivationGradOp : public OpLite {
...
@@ -79,10 +82,13 @@ class ActivationGradOp : public OpLite {
private:
private:
mutable
ActivationGradParam
param_
;
mutable
ActivationGradParam
param_
;
};
};
#endif
}
// namespace operators
}
// namespace operators
}
// namespace lite
}
// namespace lite
}
// namespace paddle
}
// namespace paddle
REGISTER_LITE_OP
(
square
,
paddle
::
lite
::
operators
::
ActivationOp
);
REGISTER_LITE_OP
(
square
,
paddle
::
lite
::
operators
::
ActivationOp
);
#ifdef LITE_WITH_X86
REGISTER_LITE_OP
(
square_grad
,
paddle
::
lite
::
operators
::
ActivationGradOp
);
REGISTER_LITE_OP
(
square_grad
,
paddle
::
lite
::
operators
::
ActivationGradOp
);
#endif
paddle/fluid/lite/operators/elementwise_ops.cc
浏览文件 @
c161f967
...
@@ -37,7 +37,6 @@ class ElementwiseOp : public OpLite {
...
@@ -37,7 +37,6 @@ class ElementwiseOp : public OpLite {
}
}
bool
AttachImpl
(
const
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
{
bool
AttachImpl
(
const
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
{
CHECK_EQ
(
opdesc
.
Inputs
().
size
(),
2UL
);
auto
X_name
=
opdesc
.
Input
(
"X"
).
front
();
auto
X_name
=
opdesc
.
Input
(
"X"
).
front
();
auto
Y_name
=
opdesc
.
Input
(
"Y"
).
front
();
auto
Y_name
=
opdesc
.
Input
(
"Y"
).
front
();
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
...
@@ -45,7 +44,7 @@ class ElementwiseOp : public OpLite {
...
@@ -45,7 +44,7 @@ class ElementwiseOp : public OpLite {
param_
.
X
=
GetVar
<
lite
::
Tensor
>
(
scope
,
X_name
);
param_
.
X
=
GetVar
<
lite
::
Tensor
>
(
scope
,
X_name
);
param_
.
Y
=
GetVar
<
lite
::
Tensor
>
(
scope
,
Y_name
);
param_
.
Y
=
GetVar
<
lite
::
Tensor
>
(
scope
,
Y_name
);
param_
.
Out
=
GetMutableVar
<
Tensor
>
(
scope
,
Out_name
);
param_
.
Out
=
GetMutableVar
<
Tensor
>
(
scope
,
Out_name
);
param_
.
axis
=
boost
::
get
<
int
>
(
opdesc
.
GetAttr
(
"axis"
));
param_
.
axis
=
GetAttr
<
int
>
(
opdesc
.
GetAttr
(
"axis"
));
return
true
;
return
true
;
}
}
...
@@ -58,6 +57,7 @@ class ElementwiseOp : public OpLite {
...
@@ -58,6 +57,7 @@ class ElementwiseOp : public OpLite {
mutable
operators
::
ElementwiseParam
param_
;
mutable
operators
::
ElementwiseParam
param_
;
};
};
#ifdef LITE_WITH_X86
class
ElementwiseGradExplicitOp
:
public
OpLite
{
class
ElementwiseGradExplicitOp
:
public
OpLite
{
public:
public:
explicit
ElementwiseGradExplicitOp
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
explicit
ElementwiseGradExplicitOp
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
...
@@ -99,11 +99,14 @@ class ElementwiseGradExplicitOp : public OpLite {
...
@@ -99,11 +99,14 @@ class ElementwiseGradExplicitOp : public OpLite {
private:
private:
mutable
operators
::
ElementwiseGradParam
param_
;
mutable
operators
::
ElementwiseGradParam
param_
;
};
};
#endif
}
// namespace operators
}
// namespace operators
}
// namespace lite
}
// namespace lite
}
// namespace paddle
}
// namespace paddle
REGISTER_LITE_OP
(
elementwise_sub
,
paddle
::
lite
::
operators
::
ElementwiseOp
);
REGISTER_LITE_OP
(
elementwise_sub
,
paddle
::
lite
::
operators
::
ElementwiseOp
);
#ifdef LITE_WITH_X86
REGISTER_LITE_OP
(
elementwise_sub_grad
,
REGISTER_LITE_OP
(
elementwise_sub_grad
,
paddle
::
lite
::
operators
::
ElementwiseGradExplicitOp
);
paddle
::
lite
::
operators
::
ElementwiseGradExplicitOp
);
#endif
paddle/fluid/lite/operators/fill_constant_op.cc
浏览文件 @
c161f967
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/lite/core/op_lite.h"
#include "paddle/fluid/lite/core/op_lite.h"
#include "paddle/fluid/lite/core/op_registry.h"
#include "paddle/fluid/lite/core/op_registry.h"
...
@@ -35,14 +34,13 @@ class FillConstantOp : public OpLite {
...
@@ -35,14 +34,13 @@ class FillConstantOp : public OpLite {
}
}
bool
AttachImpl
(
const
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
{
bool
AttachImpl
(
const
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
{
CHECK_EQ
(
opdesc
.
Inputs
().
size
(),
2UL
);
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
param_
.
Out
=
GetMutableVar
<
Tensor
>
(
scope
,
Out_name
);
param_
.
Out
=
GetMutableVar
<
Tensor
>
(
scope
,
Out_name
);
param_
.
dtype
=
boost
::
get
<
int
>
(
opdesc
.
GetAttr
(
"dtype"
));
param_
.
dtype
=
GetAttr
<
int
>
(
opdesc
.
GetAttr
(
"dtype"
));
param_
.
shape
=
boost
::
get
<
std
::
vector
<
int64_t
>>
(
opdesc
.
GetAttr
(
"shape"
));
param_
.
shape
=
GetAttr
<
std
::
vector
<
int64_t
>>
(
opdesc
.
GetAttr
(
"shape"
));
param_
.
value
=
boost
::
get
<
float
>
(
opdesc
.
GetAttr
(
"value"
));
param_
.
value
=
GetAttr
<
float
>
(
opdesc
.
GetAttr
(
"value"
));
param_
.
force_cpu
=
boost
::
get
<
bool
>
(
opdesc
.
GetAttr
(
"force_cpu"
));
param_
.
force_cpu
=
GetAttr
<
bool
>
(
opdesc
.
GetAttr
(
"force_cpu"
));
return
true
;
return
true
;
}
}
...
...
paddle/fluid/lite/operators/mean_op.cc
浏览文件 @
c161f967
...
@@ -12,7 +12,9 @@
...
@@ -12,7 +12,9 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#ifdef LITE_WITH_X86
#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/framework/operator.h"
#endif
#include "paddle/fluid/lite/core/op_lite.h"
#include "paddle/fluid/lite/core/op_lite.h"
#include "paddle/fluid/lite/core/op_registry.h"
#include "paddle/fluid/lite/core/op_registry.h"
...
@@ -36,7 +38,6 @@ class MeanOp : public OpLite {
...
@@ -36,7 +38,6 @@ class MeanOp : public OpLite {
}
}
bool
AttachImpl
(
const
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
{
bool
AttachImpl
(
const
OpDesc
&
opdesc
,
lite
::
Scope
*
scope
)
override
{
CHECK_EQ
(
opdesc
.
Inputs
().
size
(),
2UL
);
auto
X_name
=
opdesc
.
Input
(
"X"
).
front
();
auto
X_name
=
opdesc
.
Input
(
"X"
).
front
();
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
auto
Out_name
=
opdesc
.
Output
(
"Out"
).
front
();
...
@@ -53,6 +54,7 @@ class MeanOp : public OpLite {
...
@@ -53,6 +54,7 @@ class MeanOp : public OpLite {
mutable
operators
::
ElementwiseParam
param_
;
mutable
operators
::
ElementwiseParam
param_
;
};
};
#ifdef LITE_WITH_X86
class
MeanGradOp
:
public
OpLite
{
class
MeanGradOp
:
public
OpLite
{
public:
public:
explicit
MeanGradOp
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
explicit
MeanGradOp
(
const
std
::
string
&
type
)
:
OpLite
(
type
)
{}
...
@@ -89,10 +91,13 @@ class MeanGradOp : public OpLite {
...
@@ -89,10 +91,13 @@ class MeanGradOp : public OpLite {
private:
private:
mutable
operators
::
MeanGradParam
param_
;
mutable
operators
::
MeanGradParam
param_
;
};
};
#endif
}
// namespace operators
}
// namespace operators
}
// namespace lite
}
// namespace lite
}
// namespace paddle
}
// namespace paddle
REGISTER_LITE_OP
(
mean
,
paddle
::
lite
::
operators
::
MeanOp
);
REGISTER_LITE_OP
(
mean
,
paddle
::
lite
::
operators
::
MeanOp
);
#ifdef LITE_WITH_X86
REGISTER_LITE_OP
(
mean_grad
,
paddle
::
lite
::
operators
::
MeanGradOp
);
REGISTER_LITE_OP
(
mean_grad
,
paddle
::
lite
::
operators
::
MeanGradOp
);
#endif
paddle/fluid/lite/operators/mul_op.cc
浏览文件 @
c161f967
...
@@ -31,15 +31,16 @@ bool MulOpLite::CheckShape() const {
...
@@ -31,15 +31,16 @@ bool MulOpLite::CheckShape() const {
CHECK_GT_OR_FALSE
(
x_dims
.
size
(),
static_cast
<
size_t
>
(
param_
.
x_num_col_dims
));
CHECK_GT_OR_FALSE
(
x_dims
.
size
(),
static_cast
<
size_t
>
(
param_
.
x_num_col_dims
));
CHECK_GT_OR_FALSE
(
y_dims
.
size
(),
static_cast
<
size_t
>
(
param_
.
y_num_col_dims
));
CHECK_GT_OR_FALSE
(
y_dims
.
size
(),
static_cast
<
size_t
>
(
param_
.
y_num_col_dims
));
auto
x_mat_dims
=
// auto x_mat_dims =
framework
::
flatten_to_2d
(
x_dims
.
data
(),
param_
.
x_num_col_dims
);
// framework::flatten_to_2d(x_dims.data(), param_.x_num_col_dims);
auto
y_mat_dims
=
// auto y_mat_dims =
framework
::
flatten_to_2d
(
y_dims
.
data
(),
param_
.
y_num_col_dims
);
// framework::flatten_to_2d(y_dims.data(), param_.y_num_col_dims);
PADDLE_ENFORCE_EQ
(
x_mat_dims
[
1
],
y_mat_dims
[
0
],
// PADDLE_ENFORCE_EQ(x_mat_dims[1], y_mat_dims[0],
"First matrix's width must be equal with second matrix's "
// "First matrix's width must be equal with second matrix's
"height. %s, %s"
,
// "
x_mat_dims
[
1
],
y_mat_dims
[
0
]);
// "height. %s, %s",
// x_mat_dims[1], y_mat_dims[0]);
return
true
;
return
true
;
}
}
...
@@ -66,6 +67,8 @@ bool MulOpLite::InferShape() const {
...
@@ -66,6 +67,8 @@ bool MulOpLite::InferShape() const {
return
true
;
return
true
;
}
}
#ifdef LITE_WITH_X86
bool
MulGradOpLite
::
CheckShape
()
const
{
bool
MulGradOpLite
::
CheckShape
()
const
{
CHECK_OR_FALSE
(
param_
.
x
);
CHECK_OR_FALSE
(
param_
.
x
);
CHECK_OR_FALSE
(
param_
.
y
);
CHECK_OR_FALSE
(
param_
.
y
);
...
@@ -97,6 +100,7 @@ bool MulGradOpLite::AttachImpl(const OpDesc &op_desc, lite::Scope *scope) {
...
@@ -97,6 +100,7 @@ bool MulGradOpLite::AttachImpl(const OpDesc &op_desc, lite::Scope *scope) {
return
true
;
return
true
;
}
}
#endif
}
// namespace operators
}
// namespace operators
}
// namespace lite
}
// namespace lite
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录