pengwangucla opened a new issue #7956: simple_bind error when using rotation 
matrix & batch_dot
URL: https://github.com/apache/incubator-mxnet/issues/7956
 
 
   I met simple_bind fatal error
       [19:24:05] src/core/graph.cc:50: Check failed: it != node2index_.end() 
&& it->first == nptr.get()
   
   ## Environment info
   Operating System: Ubuntu 14.04
   
   Compiler:
   
   Package used (Python/R/Scala/Julia): Python
   
   MXNet version: 0.11.0
   
   Or if installed from source: Yes
   
   MXNet commit hash (`git rev-parse HEAD`): 
a5edbf94094581ee27157eae4f2113115a3994e7
   
   If you are using python package, please provide
   
   Python version and distribution: 2.7
   
   ## Error Message:
   Please paste the full error message, including stack trace.
   
   ```
   Traceback (most recent call last):
     File "Networks/net_util.py", line 168, in <module>
       executor = loss.simple_bind(ctx=mx.cpu(), pose=(1,6))
     File "/home/peng/mxnet/python/mxnet/symbol.py", line 1479, in simple_bind
       raise RuntimeError(error_msg)
   RuntimeError: simple_bind error. Arguments:
   pose: (1, 6)
   [19:24:05] src/core/graph.cc:50: Check failed: it != node2index_.end() && 
it->first == nptr.get()
   
   Stack trace returned 10 entries:
   [bt] (0) /home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(+0x273c8cd) 
[0x7f13dd5b38cd]
   [bt] (1) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm12IndexedGraphC1ERKNS_5GraphE+0x314)
 [0x7f13dd5b4a44]
   [bt] (2) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN4nnvm5Graph13indexed_graphEv+0x30)
 [0x7f13dd5b5ff0]
   [bt] (3) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet4exec13AssignContextEN4nnvm5GraphERKNS_7ContextERKSt3mapISsS3_St4lessISsESaISt4pairIKSsS3_EEERKSt6vectorIS3_SaIS3_EESK_SK_mm+0x53)
 [0x7f13dc22f293]
   [bt] (4) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet4exec13GraphExecutor9InitGraphEN4nnvm6SymbolERKNS_7ContextERKSt3mapISsS4_St4lessISsESaISt4pairIKSsS4_EEERKSt6vectorIS4_SaIS4_EESL_SL_RKSH_INS_9OpReqTypeESaISM_EE+0xaf)
 [0x7f13dc23a3bf]
   [bt] (5) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet4exec13GraphExecutor4InitEN4nnvm6SymbolERKNS_7ContextERKSt3mapISsS4_St4lessISsESaISt4pairIKSsS4_EEERKSt6vectorIS4_SaIS4_EESL_SL_RKSt13unordered_mapISsNS2_6TShapeESt4hashISsESt8equal_toISsESaISA_ISB_SN_EEERKSM_ISsiSP_SR_SaISA_ISB_iEEERKSH_INS_9OpReqTypeESaIS12_EERKSt13unordered_setISsSP_SR_SaISsEEPSH_INS_7NDArrayESaIS1C_EES1F_S1F_PSM_ISsS1C_SP_SR_SaISA_ISB_S1C_EEEPNS_8ExecutorERKSM_INS2_9NodeEntryES1C_NS2_13NodeEntryHashENS2_14NodeEntryEqualESaISA_IKS1M_S1C_EEE+0xa0)
 [0x7f13dc23c0a0]
   [bt] (6) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(_ZN5mxnet8Executor10SimpleBindEN4nnvm6SymbolERKNS_7ContextERKSt3mapISsS3_St4lessISsESaISt4pairIKSsS3_EEERKSt6vectorIS3_SaIS3_EESK_SK_RKSt13unordered_mapISsNS1_6TShapeESt4hashISsESt8equal_toISsESaIS9_ISA_SM_EEERKSL_ISsiSO_SQ_SaIS9_ISA_iEEERKSG_INS_9OpReqTypeESaIS11_EERKSt13unordered_setISsSO_SQ_SaISsEEPSG_INS_7NDArrayESaIS1B_EES1E_S1E_PSL_ISsS1B_SO_SQ_SaIS9_ISA_S1B_EEEPS0_+0x194)
 [0x7f13dc23cda4]
   [bt] (7) 
/home/peng/mxnet/python/mxnet/../../lib/libmxnet.so(MXExecutorSimpleBind+0x2261)
 [0x7f13dc1c0d01]
   [bt] (8) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) 
[0x7f1402286adc]
   [bt] (9) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x1fc) 
[0x7f140228640c]
   ```
   ## Minimum reproducible example
   if you are using your own code, please provide a short script that 
reproduces the error.
   ```python
   
   def euler2mat(rot):
        roll = mx.sym.slice_axis(rot, axis=1, begin=0, end=1)
        pitch = mx.sym.slice_axis(rot, axis=1, begin=1, end=2)
        yaw = mx.sym.slice_axis(rot, axis=1, begin=2, end=3)
   
        # Expand to B x 1 x 1
        roll = mx.sym.expand_dims(roll, axis=2)
        pitch = mx.sym.expand_dims(pitch, axis=2)
        yaw = mx.sym.expand_dims(yaw, axis=2)
        zeros = mx.sym.zeros_like(roll)
        ones  = mx.sym.ones_like(roll)
   
        cosz = mx.sym.cos(yaw)
        sinz = mx.sym.sin(yaw)
        yaw_mat_1 = mx.sym.concat(cosz, -1 * sinz, zeros, dim=2)
        yaw_mat_2 = mx.sym.concat(sinz,  cosz, zeros, dim=2)
        yaw_mat_3 = mx.sym.concat(zeros, zeros, ones, dim=2)
        yaw_mat = mx.sym.concat(yaw_mat_1, yaw_mat_2, yaw_mat_3, dim=1)
   
        cosy = mx.sym.cos(pitch)
        siny = mx.sym.sin(pitch)
        pitch_mat_1 = mx.sym.concat(cosy, zeros, siny, dim=2)
        pitch_mat_2 = mx.sym.concat(zeros, ones, zeros, dim=2)
        pitch_mat_3 = mx.sym.concat(-1 * siny, zeros, cosy, dim=2)
        pitch_mat = mx.sym.concat(pitch_mat_1, pitch_mat_2, pitch_mat_3, dim=1)
   
        # Expand to B x 3 x 3
        cosx = mx.sym.cos(roll)
        sinx = mx.sym.sin(roll)
        roll_mat_1 = mx.sym.concat(ones, zeros, zeros, dim=2)
        roll_mat_2 = mx.sym.concat(zeros, cosx, -1 * sinx, dim=2)
        roll_mat_3 = mx.sym.concat(zeros, sinx, cosx, dim=2)
        roll_mat = mx.sym.concat(roll_mat_1, roll_mat_2, roll_mat_3, dim=1)
        rotMat = mx.sym.batch_dot(yaw_mat, pitch_mat)
        rotMat = mx.sym.batch_dot(rotMat, roll_mat)
   
        return rotMat
   
   if __name__=='__main__':
        pose = mx.sym.Variable('pose')
        mat = euler2mat(pose)
        loss = mx.sym.MakeLoss(data = mx.sym.sum(mat, axis=[1,2]),
                grad_scale=1.0)
   
        pose_np = mx.nd.array(np.ones([1, 3]))
        executor = loss.simple_bind(ctx=mx.cpu(), pose=(1,3))
        executor.forward(is_train=True, pose=pose_np)
        print executor.outputs
   
        executor.backward()
        print executor.grad_arrays
   
   ````
   ## Steps to reproduce
   1. run the code, 
   
   when I remove the batch_dot, everything goes find, or I just use batch_dot 
for two matrix, it seems also ok. When I jointly use the two. The program 
crashes.
   
   I am not sure what is the reason. Anything thought on this ? 
   
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to