bartekkuncer commented on a change in pull request #20741:
URL: https://github.com/apache/incubator-mxnet/pull/20741#discussion_r749279822



##########
File path: src/operator/contrib/adaptive_avg_pooling.cc
##########
@@ -199,7 +202,53 @@ void AdaptiveAvgPoolUpdateGradInput(mshadow::Stream<cpu>* 
s,
   }
 }
 
-DMLC_REGISTER_PARAMETER(AdaptiveAvgPoolParam);
+#if MXNET_USE_ONEDNN == 1
+bool SupportDNNLAveragePooling(const NDArray& in_data, const NDArray& 
out_data) {
+  for (int64_t idx = 2; idx < in_data.shape().ndim(); ++idx) {
+    const int s1 = in_data.shape()[idx];
+    const int s2 = out_data.shape()[idx];
+    if (s2 == 0) {
+      return false;
+    }
+    if (s1 % s2 != 0) {
+      return false;
+    }
+  }
+  const int IH         = in_data.shape()[2];
+  const int IW         = in_data.shape()[3];
+  const int OH         = out_data.shape()[2];
+  const int OW         = out_data.shape()[3];
+  const int strides_H  = floor((IH << 1) / OH) - floor(IH / OH);
+  const int strides_W  = floor((IW << 1) / OW) - floor(IW / OW);
+  const int kernel_H   = ceil((IH << 1) / OH) - floor(IH / OH);
+  const int kernel_W   = ceil((IW << 1) / OW) - floor(IW / OW);
+  const int pad_l_top  = (strides_H * (OH - 1) + kernel_H - IH) / 2;
+  const int pad_l_left = (strides_W * (OW - 1) + kernel_W - IW) / 2;
+  return pad_l_top == 0 && pad_l_left == 0;
+}
+
+void AdaptiveAvgPoolComputeExCPU(const nnvm::NodeAttrs& attrs,
+                                 const OpContext& ctx,
+                                 const std::vector<NDArray>& inputs,
+                                 const std::vector<OpReqType>& req,
+                                 const std::vector<NDArray>& outputs) {
+  CHECK_EQ(inputs.size(), 1U);
+  CHECK_EQ(outputs.size(), 1U);
+  /*
+  OneDNN doesn't support adaptive pooling.

Review comment:
       oneDNN*
   Also is this comment up-to-date?
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to