samskalicky commented on a change in pull request #17762: Custom Operator
Random Number Generator Support
URL: https://github.com/apache/incubator-mxnet/pull/17762#discussion_r399628115
##########
File path: src/c_api/c_api.cc
##########
@@ -248,11 +250,21 @@ void CustomFComputeDispatcher(const std::string op_name,
// get actual cudaStream_t out of mxnet gpu stream and pass to lib_api.h
void *cuda_stream = nullptr;
#if MXNET_USE_CUDA
- if (inputs[0].ctx().dev_mask() == Context::kGPU) {
+ if (inputs.size() > 0 && inputs[0].ctx().dev_mask() == Context::kGPU) {
Review comment:
while you're making this change, its possible an operator might have zero
inputs and some outputs (ie. generator operator, like random), should we also
check for outputs if inputs is zero like:
```
if ((inputs.size() > 0 && inputs[0].ctx().dev_mask() == Context::kGPU) ||
(outputs.size() > 0 && inputs[0].ctx().dev_mask() == Context::kGPU)) {
```
----------------------------------------------------------------
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