From 7872d06ff4b34ef61d5ce3d40483996967b77687 Mon Sep 17 00:00:00 2001 From: bingyanghuang <33643817+bingyanghuang@users.noreply.github.com> Date: Tue, 7 Jan 2020 21:51:07 +0800 Subject: [PATCH] Add explanation on conv grad for dims<3 (#22125) --- paddle/fluid/platform/mkldnn_helper.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/platform/mkldnn_helper.h b/paddle/fluid/platform/mkldnn_helper.h index c10a8cc9ccb..13230cab0d1 100644 --- a/paddle/fluid/platform/mkldnn_helper.h +++ b/paddle/fluid/platform/mkldnn_helper.h @@ -74,7 +74,9 @@ tf_pd MKLDNNBwdPrimitiveDesc(const Engine& e, const Primitive& p, inline void MatchShapeToLayout(framework::Tensor* tensor_in, framework::DataLayout from, framework::DataLayout to) { - // Shape changing makes sense for 3+ dims Tensors + // In these data layouts, channel dimension is either on 2nd position: nChw or + // at last nhwC, so for dim==2 these layouts are the same and nothing should + // be done. Similarly for dim==1 when you have just one possible combination. if (tensor_in->dims().size() < 3) { return; } -- GitLab