piotrwolinski-intel commented on a change in pull request #20825:
URL: https://github.com/apache/incubator-mxnet/pull/20825#discussion_r806644597



##########
File path: src/operator/contrib/adaptive_avg_pooling.cc
##########
@@ -238,18 +277,45 @@ void AdaptiveAvgPoolComputeExCPU(const nnvm::NodeAttrs& 
attrs,
   oneDNN doesn't support adaptive pooling.
   Fallback is needed when padding is not equal 0;
   */
-  const PoolingParam& param = nnvm::get<PoolingParam>(attrs.parsed);
   if (SupportDNNL(inputs[0]) && SupportDNNLAveragePooling(inputs[0], 
outputs[0])) {
-    const NDArray* workspace = nullptr;
     DNNL_OPCHECK_INIT(false, 1, inputs, outputs);
-    DNNLPoolingCompute(ctx, param, inputs[0], req[0], outputs[0], workspace, 
true);
+    DNNLRun(DNNLPoolingCompute, attrs, ctx, inputs, req, outputs);
     DNNL_OPCHECK_RUN(PoolingCompute<cpu>, attrs, ctx, inputs, req, outputs);
     return;
   }
   FallBackCompute(AdaptiveAvgPoolOpForward<cpu>, attrs, ctx, inputs, req, 
outputs);
 }
 #endif
 
+inline static bool AdaptivePoolingStorageType(const nnvm::NodeAttrs& attrs,
+                                              const int dev_mask,
+                                              DispatchMode* dispatch_mode,
+                                              std::vector<int>* in_attrs,
+                                              std::vector<int>* out_attrs) {
+  CHECK_EQ(in_attrs->size(), 1);
+  bool dispatched = false;
+#if MXNET_USE_ONEDNN == 1
+  if (!dispatched) {
+    dispatched = DNNLStorageType(attrs, dev_mask, true, dispatch_mode, 
in_attrs, out_attrs);
+  }
+  if (!DNNLEnvSet()) {
+    *dispatch_mode = DispatchMode::kFComputeFallback;
+  }
+#else
+  for (int& v : *in_attrs)
+    if (v == -1)
+      v = kDefaultStorage;
+  if (!dispatched && common::ContainsOnlyStorage(*in_attrs, kDefaultStorage)) {
+    dispatched =
+        storage_type_assign(out_attrs, kDefaultStorage, dispatch_mode, 
DispatchMode::kFCompute);
+  }
+  if (!dispatched) {
+    dispatched = dispatch_fallback(out_attrs, dispatch_mode);
+  }
+#endif
+  return dispatched;
+}

Review comment:
       As I checked earlier I thought it was necessary to do it this way, but 
from what I've checked now it should be okay to make it similar way as in 
pooling for instance.




-- 
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