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/03/22 17:48:10 UTC

[GitHub] sxjscience commented on issue #10173: Unpredictable nan in Array

sxjscience commented on issue #10173: Unpredictable nan in Array
URL: https://github.com/apache/incubator-mxnet/issues/10173#issuecomment-375398324
 
 
   @CXMA479 Thanks for reporting this!. It seems to be a bug. I've revised the code to repeat the process multiple times:
   ```python
   import mxnet as mx
   import numpy as np
   def bench_mark(D_slice, P_slice):
       n= D_slice.shape[0]
       e3 = mx.nd.empty((n*n,2))
       for i in range(n):
           e3[n*i:n*(i+1)]  = (e3[n*i:n*(i+1)]*0+1)*( P_slice[i] - D_slice[i])
       return e3
   
   for i in range(100):
       x = mx.nd.random.uniform(shape=(2,5,2))
       y = mx.nd.random.uniform(shape=(2,5,2))
       e3_bm = bench_mark(x[0], y[0])
       print(x[0].asnumpy())
       print(y[0].asnumpy())
       print('-'*20)
       # print((e3_bm).asnumpy())
       e3_bm_npy = e3_bm.asnumpy()
       assert(np.isnan(e3_bm_npy).any() == False), str(e3_bm_npy)
   ```
   
   Result:
   
   ```log
        17     # print((e3_bm).asnumpy())
        18     e3_bm_npy = e3_bm.asnumpy()
   ---> 19     assert(np.isnan(e3_bm_npy).any() == False), str(e3_bm_npy)
        20
   
   AssertionError: [[ 0.5124911   0.45078474]
    [ 0.5124911   0.45078474]
    [ 0.5124911   0.45078474]
    [ 0.5124911   0.45078474]
    [ 0.5124911   0.45078474]
    [        nan         nan]
    [-0.57626355  0.13732177]
    [-0.57626355  0.13732177]
    [-0.57626355  0.13732177]
    [-0.57626355  0.13732177]
    [ 0.2129727  -0.06519118]
    [ 0.2129727  -0.06519118]
    [ 0.2129727  -0.06519118]
    [ 0.2129727  -0.06519118]
    [ 0.2129727  -0.06519118]
    [ 0.17914966 -0.17914736]
    [ 0.17914966 -0.17914736]
    [ 0.17914966 -0.17914736]
    [ 0.17914966 -0.17914736]
    [ 0.17914966 -0.17914736]
    [-0.6420211   0.68399173]
    [-0.6420211   0.68399173]
    [-0.6420211   0.68399173]
    [-0.6420211   0.68399173]
    [-0.6420211   0.68399173]]
   
   ```

----------------------------------------------------------------
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