eric-haibin-lin commented on a change in pull request #7947: Refactor infer
storage function for sparse operators.
URL: https://github.com/apache/incubator-mxnet/pull/7947#discussion_r141416595
##########
File path: src/executor/infer_graph_attr_pass.cc
##########
@@ -302,18 +341,27 @@ inline bool SameType(const nnvm::NodeAttrs& attrs,
return true;
}
-// assigning default type N to both input and output attrs with value -1
-template <int default_val, int none>
-inline bool DefaultType(const nnvm::NodeAttrs& attrs,
- const Context& ctx,
- std::vector<int> *iattr,
- std::vector<int> *oattr) {
- // TODO(junwu): check whether need to use ctx
+inline bool DefaultStorageType(const nnvm::NodeAttrs& attrs,
+ const int dev_mask,
+ int* dispatch_mode,
+ std::vector<int> *iattr,
+ std::vector<int> *oattr) {
+ bool fallback = false;
for (int& v : *oattr) {
- if (v == none) v = default_val;
+ if (v == -1) v = kDefaultStorage;
+ if (v != kDefaultStorage) fallback = true;
}
for (int& v : *iattr) {
Review comment:
As discussed offline, not really necessary to change it in a for loop.
----------------------------------------------------------------
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