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_r393329863
##########
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) {
Review comment:
can we do this first and put this code inside the else block?
```
// convert attributes to vector of char*
std::vector<const char*> attr_keys, attr_vals;
for (auto kv : attrs.dict) {
attr_keys.push_back(kv.first.c_str());
attr_vals.push_back(kv.second.c_str());
}
// copy input types from in_stype
std::vector<int> instypes(*in_stypes);
// output types will be populated by inferType function
std::vector<int> outstypes(out_stypes->size());
```
----------------------------------------------------------------
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