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

 ##########
 File path: example/extensions/lib_custom_op/gemm_lib.cc
 ##########
 @@ -140,6 +140,22 @@ MXReturnValue inferType(std::map<std::string, 
std::string> attrs,
   return MX_SUCCESS;
 }
 
+MXReturnValue inferSType(std::map<std::string, std::string> attrs,
+                        std::vector<int> &instypes,
+                        std::vector<int> &outstypes) {
+  // validate inputs
+  for (unsigned i = 0; i < instypes.size(); i++) {
+    if (instypes[i] != kDefaultStorage) {
+      std::cout << "Expected input " << i << " to have dense storage type" << 
std::endl;
+      return MX_FAIL;
+    }
+  }
+  for (unsigned i = 0; i < instypes.size(); i++) {
+    outstypes[i] = instypes[0];
 
 Review comment:
   Fixed it.

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