Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
5e874cc3
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
5e874cc3
编写于
9月 02, 2020
作者:
J
Jacek Czaja
提交者:
GitHub
9月 02, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Cosmetic fixes to align with PADDLE_ENFORCE guidelines (#26891)
test=develop
上级
e6af53b1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
44 addition
and
26 deletion
+44
-26
paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc
paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc
+11
-7
paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc
paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc
+4
-2
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
+7
-5
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
+6
-3
paddle/fluid/operators/mkldnn/conv_transpose_mkldnn_op.cc
paddle/fluid/operators/mkldnn/conv_transpose_mkldnn_op.cc
+2
-1
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
+12
-7
paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc
paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc
+2
-1
未找到文件。
paddle/fluid/operators/mkldnn/activation_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -33,10 +33,12 @@ class MKLDNNActivationKernel
public:
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
const
auto
*
x
=
ctx
.
Input
<
Tensor
>
(
"X"
);
PADDLE_ENFORCE_EQ
(
x
->
layout
(),
DataLayout
::
kMKLDNN
,
"Wrong layout set for X tensor"
);
PADDLE_ENFORCE_NE
(
x
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for X tensor"
);
PADDLE_ENFORCE_EQ
(
x
->
layout
(),
DataLayout
::
kMKLDNN
,
platform
::
errors
::
InvalidArgument
(
"Wrong layout set for X tensor"
));
PADDLE_ENFORCE_NE
(
x
->
format
(),
MKLDNNMemoryFormat
::
undef
,
platform
::
errors
::
InvalidArgument
(
"Wrong format set for X tensor"
));
Functor
functor
;
functor
(
ctx
);
...
...
@@ -50,9 +52,11 @@ class MKLDNNActivationGradKernel
void
Compute
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
const
auto
*
diff_y
=
ctx
.
Input
<
Tensor
>
(
framework
::
GradVarName
(
"Out"
));
PADDLE_ENFORCE_EQ
(
diff_y
->
layout
(),
DataLayout
::
kMKLDNN
,
"Wrong layout set for Input OutGrad tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong layout set for Input OutGrad tensor"
));
PADDLE_ENFORCE_NE
(
diff_y
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for Input OutGrad tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong format set for Input OutGrad tensor"
));
Functor
functor
;
functor
(
ctx
);
...
...
@@ -82,7 +86,7 @@ void eltwise_forward(const framework::ExecutionContext &ctx,
PADDLE_ENFORCE
(
x
->
dims
().
size
()
==
2
||
x
->
dims
().
size
()
==
3
||
x
->
dims
().
size
()
==
4
,
"Input dim must be with 2, 3 or 4"
);
platform
::
errors
::
Unimplemented
(
"Input dim must be with 2, 3 or 4"
)
);
auto
src_tz
=
framework
::
vectorize
<
int64_t
>
(
x
->
dims
());
...
...
paddle/fluid/operators/mkldnn/batch_norm_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -262,9 +262,11 @@ class BatchNormMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> {
auto
*
diff_shift
=
ctx
.
Output
<
Tensor
>
(
framework
::
GradVarName
(
"Bias"
));
PADDLE_ENFORCE_EQ
(
diff_y
->
layout
(),
DataLayout
::
kMKLDNN
,
"Wrong layout set for Input diff_y tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong layout set for Input diff_y tensor"
));
PADDLE_ENFORCE_NE
(
diff_y
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for Input diff_y tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong format set for Input diff_y tensor"
));
auto
src_tz
=
paddle
::
framework
::
vectorize
<
int64_t
>
(
x
->
dims
());
auto
scale_tz
=
paddle
::
framework
::
vectorize
<
int64_t
>
(
scale
->
dims
());
...
...
paddle/fluid/operators/mkldnn/concat_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -30,10 +30,12 @@ using platform::to_void_cast;
static
void
EnforceLayouts
(
const
std
::
vector
<
const
Tensor
*>
inputs
)
{
for
(
auto
*
input
:
inputs
)
{
PADDLE_ENFORCE_EQ
(
input
->
layout
(),
DataLayout
::
kMKLDNN
,
"Wrong layout set for Input tensor"
);
PADDLE_ENFORCE_NE
(
input
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for Input tensor"
);
PADDLE_ENFORCE_EQ
(
input
->
layout
(),
DataLayout
::
kMKLDNN
,
platform
::
errors
::
InvalidArgument
(
"Wrong layout set for Input tensor"
));
PADDLE_ENFORCE_NE
(
input
->
format
(),
MKLDNNMemoryFormat
::
undef
,
platform
::
errors
::
InvalidArgument
(
"Wrong format set for Input tensor"
));
}
}
...
...
@@ -49,7 +51,7 @@ static platform::CPUPlace GetCpuPlace(
const
paddle
::
framework
::
ExecutionContext
&
ctx
)
{
auto
place
=
ctx
.
GetPlace
();
PADDLE_ENFORCE
(
paddle
::
platform
::
is_cpu_place
(
place
),
"It must use CPUPlace."
);
platform
::
errors
::
InvalidArgument
(
"It must use CPUPlace."
)
);
return
BOOST_GET_CONST
(
platform
::
CPUPlace
,
place
);
}
...
...
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -561,7 +561,8 @@ class ConvMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
PADDLE_ENFORCE_EQ
(
!
fuse_residual_conn
||
!
force_fp32_output
,
true
,
"residual fusion does not support force output with fp32"
);
platform
::
errors
::
Unimplemented
(
"residual fusion does not support force output with fp32"
));
auto
*
bias
=
ctx
.
HasInput
(
"Bias"
)
?
ctx
.
Input
<
Tensor
>
(
"Bias"
)
:
nullptr
;
...
...
@@ -625,7 +626,8 @@ class ConvMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
?
dilations
.
size
()
==
3
&&
dilations
[
0
]
==
1
&&
dilations
[
1
]
==
1
&&
dilations
[
2
]
==
1
:
dilations
.
size
()
==
2
&&
dilations
[
0
]
==
1
&&
dilations
[
1
]
==
1
,
true
,
"dilation in convolution is not implemented yet"
);
true
,
platform
::
errors
::
Unimplemented
(
"dilation in convolution is not implemented yet"
));
const
K
*
filter_data
=
filter
->
data
<
K
>
();
auto
scale_in_data
=
ctx
.
Attr
<
float
>
(
"Scale_in"
);
...
...
@@ -887,7 +889,8 @@ class ConvMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> {
"The output_grad tensor's layout should be %d, but got %d."
,
DataLayout
::
kMKLDNN
,
output_grad
->
layout
()));
PADDLE_ENFORCE_NE
(
output_grad
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for output_grad tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong format set for output_grad tensor"
));
PADDLE_ENFORCE_EQ
(
ctx
.
Attr
<
bool
>
(
"is_test"
),
false
,
...
...
paddle/fluid/operators/mkldnn/conv_transpose_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -117,7 +117,8 @@ class ConvTransposeMKLDNNOpKernel : public paddle::framework::OpKernel<T> {
PADDLE_ENFORCE
(
dilations
.
size
()
==
2
&&
dilations
[
0
]
==
1
&&
dilations
[
1
]
==
1
,
"dilation in convolution is not implemented yet"
);
platform
::
errors
::
Unimplemented
(
"dilation in convolution is not implemented yet"
));
const
T
*
input_data
=
input
->
data
<
T
>
();
const
T
*
filter_data
=
filter
->
data
<
T
>
();
...
...
paddle/fluid/operators/mkldnn/pool_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -83,19 +83,24 @@ class PoolMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> {
const
Tensor
*
out_grad
=
ctx
.
Input
<
Tensor
>
(
framework
::
GradVarName
(
"Out"
));
Tensor
*
in_x_grad
=
ctx
.
Output
<
Tensor
>
(
framework
::
GradVarName
(
"X"
));
PADDLE_ENFORCE_EQ
(
in_x
->
layout
(),
DataLayout
::
kMKLDNN
,
"Wrong layout set for Input tensor"
);
PADDLE_ENFORCE_NE
(
in_x
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for Input tensor"
);
PADDLE_ENFORCE_EQ
(
in_x
->
layout
(),
DataLayout
::
kMKLDNN
,
platform
::
errors
::
InvalidArgument
(
"Wrong layout set for Input tensor"
));
PADDLE_ENFORCE_NE
(
in_x
->
format
(),
MKLDNNMemoryFormat
::
undef
,
platform
::
errors
::
InvalidArgument
(
"Wrong format set for Input tensor"
));
PADDLE_ENFORCE_EQ
(
out_grad
->
layout
(),
DataLayout
::
kMKLDNN
,
"Wrong layout set for Input output_grad tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong layout set for Input output_grad tensor"
));
PADDLE_ENFORCE_NE
(
out_grad
->
format
(),
MKLDNNMemoryFormat
::
undef
,
"Wrong format set for Input output_grad tensor"
);
platform
::
errors
::
InvalidArgument
(
"Wrong format set for Input output_grad tensor"
));
PADDLE_ENFORCE_EQ
(
ctx
.
Attr
<
bool
>
(
"is_test"
),
false
,
"is_test attribute should be set to False in training phase."
);
platform
::
errors
::
InvalidArgument
(
"is_test attribute should be set to False in training phase."
));
std
::
string
pooling_type
=
ctx
.
Attr
<
std
::
string
>
(
"pooling_type"
);
...
...
paddle/fluid/operators/mkldnn/softmax_mkldnn_op.cc
浏览文件 @
5e874cc3
...
...
@@ -140,7 +140,8 @@ class SoftmaxMKLDNNGradKernel : public paddle::framework::OpKernel<T> {
PADDLE_ENFORCE_EQ
(
dout
->
dims
(),
dx
->
dims
(),
"The shape of softmax_grad's input and output must be identical."
);
platform
::
errors
::
InvalidArgument
(
"The shape of softmax_grad's input and output must be identical."
));
auto
dims
=
dout
->
dims
();
// input and output share the same shape
const
int
axis
=
CanonicalAxis
(
ctx
.
Attr
<
int
>
(
"axis"
),
dims
.
size
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录