samskalicky commented on a change in pull request #17569: Adding sparse support 
to MXTensor for custom operators
URL: https://github.com/apache/incubator-mxnet/pull/17569#discussion_r393329472
 
 

 ##########
 File path: src/c_api/c_api.cc
 ##########
 @@ -657,18 +655,29 @@ int MXLoadLib(const char *path) {
       // output types will be populated by inferType function
       std::vector<int> outstypes(out_stypes->size());
 
-      CHECK(callInferSType(stype_fp, attr_keys.data(), attr_vals.data(), 
attr_keys.size(),
-                           instypes.data(), in_stypes->size(),
-                           outstypes.data(), out_stypes->size()))
-      << "Error calling InferSType for custom operator '" << name_str << "'";
-
-      // copy and assign output storage types from custom op to MXNet memory.
-      for (size_t i = 0; i < out_stypes->size(); i++) {
-        STORAGE_TYPE_ASSIGN_CHECK(*out_stypes, i, outstypes[i]);
+      // InferSType is not defineid in customized lib.
+      if (stype_fp == nullptr) {
+        CHECK(mxnet::common::ContainsOnlyStorage(*in_stypes, 
mxnet::kDefaultStorage))
+        << "Error input tensors are not dense for custom operator '" << 
name_str << "'";
+        // set outputs as dense
+        return op::storage_type_assign(out_stypes, mxnet::kDefaultStorage,
+                                       dispatch_mode, 
DispatchMode::kFComputeEx);
+      }
+      // InferSType is defineid in customized lib.
 
 Review comment:
   defineid ==> defined

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to