pengzhao-intel commented on a change in pull request #13530: Integrate MKLDNN 
Conv1d and support 3d layout
URL: https://github.com/apache/incubator-mxnet/pull/13530#discussion_r243875033
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_base-inl.h
 ##########
 @@ -253,14 +254,23 @@ inline static mkldnn::memory::desc GetWeightDesc(const 
NDArray &arr,
   if (num_groups == 1) {
     return GetMemDesc(arr);
   } else {
-    CHECK_EQ(arr.shape().ndim(), 4U);
-    mkldnn::memory::dims tz = mkldnn::memory::dims{ num_groups,
-      static_cast<int>(arr.shape()[0] / num_groups),
-      static_cast<int>(arr.shape()[1]),
-      static_cast<int>(arr.shape()[2]),
-      static_cast<int>(arr.shape()[3])};
-    return mkldnn::memory::desc{tz, get_mkldnn_type(arr.dtype()),
-                                mkldnn::memory::format::any};
+    CHECK((arr.shape().ndim() == 3) || (arr.shape().ndim() == 4))
 
 Review comment:
   Use a variable to save the value of `arr.shape().ndim()` to avoid mutiple 
time call

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to