Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
b0c38568
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b0c38568
编写于
11月 07, 2022
作者:
S
Sławomir Siwek
提交者:
GitHub
11月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[PHI] Migrate depthwise_conv2d_grad and conv3d_grad kernels (#47686)
* remove fwd funcs * migrate conv grads
上级
383f1c4f
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
70 addition
and
957 deletion
+70
-957
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
+0
-955
paddle/phi/kernels/onednn/conv_grad_kernel.cc
paddle/phi/kernels/onednn/conv_grad_kernel.cc
+70
-2
未找到文件。
paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc
已删除
100644 → 0
浏览文件 @
383f1c4f
此差异已折叠。
点击以展开。
paddle/phi/kernels/onednn/conv_grad_kernel.cc
浏览文件 @
b0c38568
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
// limitations under the License.
// limitations under the License.
#include "paddle/phi/kernels/conv_grad_kernel.h"
#include "paddle/phi/kernels/conv_grad_kernel.h"
#include "paddle/fluid/platform/profiler/event_tracing.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/core/visit_type.h"
#include "paddle/phi/kernels/funcs/data_layout_transform.h"
#include "paddle/phi/kernels/funcs/data_layout_transform.h"
...
@@ -54,7 +54,7 @@ void ConvGradKernel(const Context& dev_ctx,
...
@@ -54,7 +54,7 @@ void ConvGradKernel(const Context& dev_ctx,
PADDLE_ENFORCE_EQ
(
dev_ctx
.
GetPlace
().
GetType
(),
PADDLE_ENFORCE_EQ
(
dev_ctx
.
GetPlace
().
GetType
(),
AllocationType
::
CPU
,
AllocationType
::
CPU
,
phi
::
errors
::
PreconditionNotMet
(
phi
::
errors
::
PreconditionNotMet
(
"Operator
DNNL
ConvGrad must use CPUPlace"
));
"Operator
oneDNN
ConvGrad must use CPUPlace"
));
const
auto
&
onednn_engine
=
dev_ctx
.
GetEngine
();
const
auto
&
onednn_engine
=
dev_ctx
.
GetEngine
();
const
auto
*
bias
=
const
auto
*
bias
=
...
@@ -140,6 +140,11 @@ void ConvGradKernel(const Context& dev_ctx,
...
@@ -140,6 +140,11 @@ void ConvGradKernel(const Context& dev_ctx,
diff_weights_memory_p
);
diff_weights_memory_p
);
{
{
paddle
::
platform
::
RecordEvent
record_reorder
(
"int_reorder"
,
paddle
::
platform
::
TracerEventType
::
UserDefined
,
2
,
paddle
::
platform
::
EventRole
::
kUniqueOp
);
reorder_p
->
execute
(
reorder_p
->
execute
(
astream
,
*
diff_weights_memory_p
,
*
reorder_dst_memory_p
);
astream
,
*
diff_weights_memory_p
,
*
reorder_dst_memory_p
);
astream
.
wait
();
astream
.
wait
();
...
@@ -182,6 +187,60 @@ void ConvGradKernel(const Context& dev_ctx,
...
@@ -182,6 +187,60 @@ void ConvGradKernel(const Context& dev_ctx,
}));
}));
}
}
template
<
typename
T
,
typename
Context
>
void
DepthwiseConvGradKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
filter
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int
>&
strides
,
const
std
::
vector
<
int
>&
paddings
,
const
std
::
string
&
padding_algorithm
,
int
groups
,
const
std
::
vector
<
int
>&
dilations
,
const
std
::
string
&
data_format
,
DenseTensor
*
input_grad
,
DenseTensor
*
filter_grad
)
{
ConvGradKernel
<
T
,
Context
>
(
dev_ctx
,
input
,
filter
,
out_grad
,
strides
,
paddings
,
padding_algorithm
,
dilations
,
groups
,
data_format
,
input_grad
,
filter_grad
);
}
template
<
typename
T
,
typename
Context
>
void
Conv3DGradKernel
(
const
Context
&
dev_ctx
,
const
DenseTensor
&
input
,
const
DenseTensor
&
filter
,
const
DenseTensor
&
out_grad
,
const
std
::
vector
<
int
>&
strides
,
const
std
::
vector
<
int
>&
paddings
,
const
std
::
string
&
padding_algorithm
,
int
groups
,
const
std
::
vector
<
int
>&
dilations
,
const
std
::
string
&
data_format
,
DenseTensor
*
input_grad
,
DenseTensor
*
filter_grad
)
{
ConvGradKernel
<
T
,
Context
>
(
dev_ctx
,
input
,
filter
,
out_grad
,
strides
,
paddings
,
padding_algorithm
,
dilations
,
groups
,
data_format
,
input_grad
,
filter_grad
);
}
}
// namespace phi
}
// namespace phi
PD_REGISTER_KERNEL
(
conv2d_grad
,
PD_REGISTER_KERNEL
(
conv2d_grad
,
...
@@ -190,3 +249,12 @@ PD_REGISTER_KERNEL(conv2d_grad,
...
@@ -190,3 +249,12 @@ PD_REGISTER_KERNEL(conv2d_grad,
phi
::
ConvGradKernel
,
phi
::
ConvGradKernel
,
float
,
float
,
phi
::
dtype
::
bfloat16
)
{}
phi
::
dtype
::
bfloat16
)
{}
PD_REGISTER_KERNEL
(
depthwise_conv2d_grad
,
OneDNN
,
ONEDNN
,
phi
::
DepthwiseConvGradKernel
,
float
,
phi
::
dtype
::
bfloat16
)
{}
PD_REGISTER_KERNEL
(
conv3d_grad
,
OneDNN
,
ONEDNN
,
phi
::
Conv3DGradKernel
,
float
)
{}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录