samskalicky commented on a change in pull request #17270: [WIP] Dynamic custom
operator GPU support
URL: https://github.com/apache/incubator-mxnet/pull/17270#discussion_r369154109
##########
File path: src/c_api/c_api.cc
##########
@@ -408,24 +452,13 @@ int MXLoadLib(const char *path) {
std::vector<int> in_dims, out_dims;
std::vector<int> in_types, out_types;
std::vector<size_t> in_verIDs, out_verIDs;
+ std::vector<const char*> in_dev_type, out_dev_type;
+ std::vector<int> in_dev_id, out_dev_id;
- // convert input tensors to constituent parts
- for (size_t i = 0; i < inputs.size(); i++) {
- in_data.push_back(inputs[i].data().dptr_);
- in_shapes.push_back(inputs[i].shape().data());
- in_dims.push_back(inputs[i].shape().ndim());
- in_types.push_back(inputs[i].dtype());
- in_verIDs.push_back(inputs[i].version());
- }
-
- // convert output tensors to constituent parts
- for (size_t i = 0; i < outputs.size(); i++) {
- out_data.push_back(outputs[i].data().dptr_);
- out_shapes.push_back(outputs[i].shape().data());
- out_dims.push_back(outputs[i].shape().ndim());
- out_types.push_back(outputs[i].dtype());
- out_verIDs.push_back(outputs[i].version());
- }
+ NDArrayToCTypes(inputs, in_data, in_shapes, in_dims, in_types,
+ in_verIDs, in_dev_type, in_dev_id);
+ NDArrayToCTypes(outputs, out_data, out_shapes, out_dims, out_types,
+ out_verIDs, out_dev_type, out_dev_id);
Review comment:
this is a great refactor! saves space and adds clarity!!
----------------------------------------------------------------
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