You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/05/06 05:17:48 UTC

[GitHub] eric-haibin-lin commented on a change in pull request #10714: [MXNET-364] broadcast_add/sub between CSR and 1D dense vector on CPU

eric-haibin-lin commented on a change in pull request #10714: [MXNET-364] broadcast_add/sub between CSR and 1D dense vector on CPU
URL: https://github.com/apache/incubator-mxnet/pull/10714#discussion_r186278756
 
 

 ##########
 File path: src/operator/tensor/elemwise_binary_broadcast_op.h
 ##########
 @@ -105,6 +105,34 @@ inline bool BinaryBroadcastMulStorageType(const nnvm::NodeAttrs& attrs,
   return dispatched;
 }
 
+inline bool BinaryBroadcastAddStorageType(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(), 2U);
+  CHECK_EQ(out_attrs->size(), 1U);
+  const int lhs_stype = in_attrs->at(0);
+  const int rhs_stype = in_attrs->at(1);
+  int& out_stype = out_attrs->at(0);
+  bool dispatched = false;
+  // For GPU, directly fallback
+  const auto dispatch_ex = (dev_mask == mshadow::gpu::kDevMask)? DispatchMode::kFComputeFallback :
+                           DispatchMode::kFComputeEx;
+  if (!dispatched && common::ContainsOnlyStorage(*in_attrs, kDefaultStorage)) {
+    dispatched = storage_type_assign(&out_stype, kDefaultStorage,
+                                     dispatch_mode, DispatchMode::kFCompute);
+  }
+  if (!dispatched && lhs_stype == kCSRStorage && rhs_stype == kDefaultStorage) {
 
 Review comment:
   What about lhs = default, rhs = csr? Can that be supported like elemwise op by supporting "reverse" in BinaryBroadcastCsrDnsDnsImpl?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services