Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f4a6c539
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
f4a6c539
编写于
9月 26, 2022
作者:
J
Jacek Czaja
提交者:
GitHub
9月 26, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Conv grad to use set_mem_desc() (#46459)
* - Conv grad changed for MD * - lint * - compilation fix * yet another lint
上级
cdcc0013
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
9 addition
and
9 deletion
+9
-9
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
+9
-9
未找到文件。
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
浏览文件 @
f4a6c539
...
@@ -1048,14 +1048,12 @@ class ConvMKLDNNGradOpKernel : public framework::OpKernel<T> {
...
@@ -1048,14 +1048,12 @@ class ConvMKLDNNGradOpKernel : public framework::OpKernel<T> {
{
DNNL_ARG_DIFF_WEIGHTS
,
*
diff_weights_memory_p
}});
{
DNNL_ARG_DIFF_WEIGHTS
,
*
diff_weights_memory_p
}});
astream
.
wait
();
astream
.
wait
();
filter_grad
->
set_layout
(
framework
::
DataLayout
::
kMKLDNN
);
// in OneDNN groups in convolution are treated as separate dimension
// which is not the case in paddlepaddle
auto
filter_fmt
=
platform
::
GetMKLDNNFormat
(
*
diff_weights_memory_p
);
// For convolution with groups convert from blocked to NCHW
// For convolution with groups convert from blocked to NCHW
// otherwise there will be problems in next operators working on this data
// otherwise there will be problems in next operators working on this data
if
(
g
>
1
)
{
if
(
g
>
1
)
{
// in OneDNN groups in convolution are treated as separate dimension
// which is not the case in paddlepaddle
dnnl
::
memory
::
data_type
in_type
=
framework
::
ToMKLDNNDataType
(
dnnl
::
memory
::
data_type
in_type
=
framework
::
ToMKLDNNDataType
(
framework
::
TransToProtoVarType
(
filter
->
dtype
()));
framework
::
TransToProtoVarType
(
filter
->
dtype
()));
// for 3d conv with groups (six dimensional data reorder to goidhw)
// for 3d conv with groups (six dimensional data reorder to goidhw)
...
@@ -1094,9 +1092,12 @@ class ConvMKLDNNGradOpKernel : public framework::OpKernel<T> {
...
@@ -1094,9 +1092,12 @@ class ConvMKLDNNGradOpKernel : public framework::OpKernel<T> {
dnnl
::
memory
::
format_tag
target_format
=
dnnl
::
memory
::
format_tag
target_format
=
weights_tz
.
size
()
==
6
?
dnnl
::
memory
::
format_tag
::
oidhw
weights_tz
.
size
()
==
6
?
dnnl
::
memory
::
format_tag
::
oidhw
:
dnnl
::
memory
::
format_tag
::
oihw
;
:
dnnl
::
memory
::
format_tag
::
oihw
;
filter_grad
->
set_format
(
target_format
);
filter_grad
->
set_mem_desc
(
dnnl
::
memory
::
desc
(
phi
::
vectorize
<
int64_t
>
(
filter_grad
->
dims
()),
in_type
,
target_format
));
}
else
{
}
else
{
filter_grad
->
set_
format
(
filter_fmt
);
filter_grad
->
set_
mem_desc
(
diff_weights_memory_p
->
get_desc
()
);
}
}
}
}
if
(
input_grad
)
{
if
(
input_grad
)
{
...
@@ -1119,8 +1120,7 @@ class ConvMKLDNNGradOpKernel : public framework::OpKernel<T> {
...
@@ -1119,8 +1120,7 @@ class ConvMKLDNNGradOpKernel : public framework::OpKernel<T> {
{
DNNL_ARG_DIFF_SRC
,
*
diff_src_memory_p
}});
{
DNNL_ARG_DIFF_SRC
,
*
diff_src_memory_p
}});
astream
.
wait
();
astream
.
wait
();
input_grad
->
set_layout
(
framework
::
DataLayout
::
kMKLDNN
);
input_grad
->
set_mem_desc
(
diff_src_memory_p
->
get_desc
());
input_grad
->
set_format
(
platform
::
GetMKLDNNFormat
(
*
diff_src_memory_p
));
}
}
}
}
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录