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/01/30 03:00:11 UTC

[GitHub] ZiyueHuang commented on a change in pull request #9625: sparse regression operators

ZiyueHuang commented on a change in pull request #9625: sparse regression operators
URL: https://github.com/apache/incubator-mxnet/pull/9625#discussion_r164629738
 
 

 ##########
 File path: src/operator/regression_output-inl.h
 ##########
 @@ -77,12 +78,41 @@ inline bool RegressionOpShape(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
+template<int label_pos>
+inline bool RegressionInferStorageType(const nnvm::NodeAttrs& attrs,
+                                       const int dev_mask,
+                                       DispatchMode* dispatch_mode,
+                                       std::vector<int>* in_attrs,
+                                       std::vector<int>* out_attrs) {
+  const auto label_stype = in_attrs->at(label_pos);
+  auto& out_stype = out_attrs->at(0);
+  bool dispatched = false;
+  if (!dispatched && label_stype == kDefaultStorage) {
+    dispatched = storage_type_assign(&out_stype, kDefaultStorage,
+                                     dispatch_mode, DispatchMode::kFCompute);
+  }
+
+  if (!dispatched && label_stype == kCSRStorage) {
+    dispatched = storage_type_assign(&out_stype, kDefaultStorage,
+                                     dispatch_mode, DispatchMode::kFComputeEx);
+  }
+
+  if (!dispatched) {
+    dispatched = dispatch_fallback(out_attrs, dispatch_mode);
+  }
+  if (out_attrs->size() > 1) type_assign(&out_attrs->at(1), kDefaultStorage);
 
 Review comment:
   In backward pass, although we don't care about gradients of label, a storage type should be assigned to it. 

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