You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/01 00:17:37 UTC

[GitHub] andrewfayres commented on issue #11926: segfault in native code while trying to use CustomOp

andrewfayres commented on issue #11926: segfault in native code while trying to use CustomOp
URL: https://github.com/apache/incubator-mxnet/issues/11926#issuecomment-409408399
 
 
   Alright, did some investigating. First a workaround, changing the returns in your inferShape and inferType to this seems to get around the problem:
       (Array(data.shape), Array(data.shape), null)
       (Array(data.dtype), Array(data.dtype), null)
   
   Likely the middle could also be null but I didn't test that explicitly. Now for a more in-depth explanation of what's happening. The segfault is happening in [this inferShape JNI code](https://github.com/apache/incubator-mxnet/blob/656e352f8dc898f21f4979331f87983b719350c3/scala-package/native/src/main/native/org_apache_mxnet_native_c_api.cc#L2161) and would also happen in [this inferType JNI code](https://github.com/apache/incubator-mxnet/blob/656e352f8dc898f21f4979331f87983b719350c3/scala-package/native/src/main/native/org_apache_mxnet_native_c_api.cc#L2211). The issue here is that what the JNI code calls numInputs is actually [defined](https://github.com/apache/incubator-mxnet/blob/656e352f8dc898f21f4979331f87983b719350c3/src/operator/custom/custom.cc#L135) to be the sum of the inputs, outputs, and aux. So in this particular case numInputs is 1, we go into the for loop and try to do a env->GetObjectArrayElement(ret, 0) which is failing.
   
   Hopefully this unblocks you. I'll give some thought to how this should be fixed in the JNI code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services