Skip to content

Commit 73dbab3

Browse files
authored
[oneDNN] Fix to conv2d grad with groups (#27006) (#27147)
* - Added fix to mobilenet * - compilation fix * - Fix to conv2d grad oneDNN with groups test=develop
1 parent da95178 commit 73dbab3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

paddle/fluid/operators/mkldnn/conv_mkldnn_op.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,11 @@ class ConvMKLDNNGradOpKernel : public paddle::framework::OpKernel<T> {
10521052
astream.wait();
10531053

10541054
filter_grad->set_layout(DataLayout::kMKLDNN);
1055-
filter_grad->set_format(GetMKLDNNFormat(*diff_weights_memory_p));
1055+
// in OneDNN groups in convolution are treated as separate dimension
1056+
// which is not the case in paddlepaddle
1057+
auto filter_fmt = GetMKLDNNFormat(*diff_weights_memory_p);
1058+
filter_grad->set_format(platform::MKLDNNFormatForSize(
1059+
g > 1 ? weights_tz.size() - 1 : weights_tz.size(), filter_fmt));
10561060
}
10571061
if (input_grad) {
10581062
auto weights_memory_p = handler.AcquireWeightsMemoryFromDataPrimitive(

0 commit comments

Comments
 (0)