vinig opened a new issue #8231: [MXNet 0.11.0 + RPi 3 + Python 2.7] ndarray 
unit test fails
URL: https://github.com/apache/incubator-mxnet/issues/8231
 
 
   ## Description
   I'm trying to build MXNet (0.11.0) for Raspberry Pi 3 with Python 2.7, 
OpenBLAS, OPENCV and LAPACK. (cross-compiled MXNet on RHEL)
   When I run unit tests (tests/python/unittest), 
test_ndarray.test_ndarray_slice fails for AssertionError (check Error Message 
section). I upgraded numpy and scipy version, since debian package manager was 
installing older versions, which were not compatible with tests. Current numpy 
version is 1.13.3 and scipy version is 1.19.1. Version upgrade resolved other 
unit tests failures except this one. It is strange because none of the 
functionality is broken but the arrays are different. (check the last section) 
How is that happening?
   
   My question is what is the correct set of versions for various dependencies 
to build and use MXNet for RPi 3?
   My aim is to get all the unit tests working for the MXNet version 0.11.0 on 
RPi 3.
   
   ## Environment info
   
   ```
   ----------Python Info----------
   ('Version      :', '2.7.9')
   ('Compiler     :', 'GCC 4.9.2')
   ('Build        :', ('default', 'Sep 17 2016 20:26:04'))
   ('Arch         :', ('32bit', 'ELF'))
   ------------Pip Info-----------
   ('Version      :', '1.5.6')
   ('Directory    :', '/usr/lib/python2.7/dist-packages/pip')
   ----------MXNet Info-----------
   ('Version      :', '0.11.0')
   ('Directory    :', 
'/usr/local/lib/python2.7/dist-packages/mxnet-0.11.0-py2.7.egg/mxnet')
   Traceback (most recent call last):
     File "diagnose.py", line 108, in check_mxnet
       with open(commit_hash, 'r') as f:
   IOError: [Errno 2] No such file or directory: 
'/usr/local/lib/python2.7/dist-packages/mxnet-0.11.0-py2.7.egg/mxnet/COMMIT_HASH'
   
   ----------System Info----------
   ('Platform     :', 'Linux-4.9.35-v7+-armv7l-with-debian-8.0')
   ('system       :', 'Linux')
   ('node         :', 'raspberrypi')
   ('release      :', '4.9.35-v7+')
   ('version      :', '#1014 SMP Fri Jun 30 14:47:43 BST 2017')
   ----------Hardware Info----------
   ('machine      :', 'armv7l')
   ('processor    :', '')
   Architecture:          armv7l
   Byte Order:            Little Endian
   CPU(s):                4
   On-line CPU(s) list:   0-3
   Thread(s) per core:    1
   Core(s) per socket:    4
   Socket(s):             1
   Model name:            ARMv7 Processor rev 4 (v7l)
   CPU max MHz:           1200.0000
   CPU min MHz:           600.0000
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0101 
sec, LOAD: 0.5146 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0095 sec, LOAD: 
0.2694 sec.
   Timing for FashionMNIST: 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
 DNS: 0.0456 sec, LOAD: 0.1679 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0166 sec, 
LOAD: 0.0695 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0106 sec, LOAD: 
0.0516 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0467 sec, LOAD: 
0.2191 sec.
   ```
   
   Package used (Python/R/Scala/Julia): Python
   
   ## Build info
   
   Compiler (gcc/clang/mingw/visual studio): gcc version 4.9.2 (Raspbian 
4.9.2-10) (target: arm-linux-gnueabihf)
   
   MXNet commit hash: a5edbf94094581ee27157eae4f2113115a3994e7
   
   Build config:
   OpenBLAS build on Pi, installed and ported to RHEL for cross-compilation:
   make FC=gfortran -j4
   
   config.mk
   USE_PROFILER=1
   ADD_LDFLAGS=-L/path/to/openblas/ext/lib /path/to/static/libopenblas.a
   ADD_CFLAGS=-I/path/to/openblas/ext/include
   USE_BLAS=openblas
   USE_OPENCV=1
   USE_OPENMP=0
   USE_LAPACK=1
   USE_LAPACK_PATH=/path/to/lapack/static/lib
   
   MXNet installation depends on following libraries:
   librt.so.1
   libopencv_dnn.so.3.3
   libopencv_ml.so.3.3
   libopencv_objdetect.so.3.3
   libopencv_shape.so.3.3
   libopencv_stitching.so.3.3
   libopencv_superres.so.3.3
   libopencv_videostab.so.3.3
   libopencv_calib3d.so.3.3
   libopencv_features2d.so.3.3
   libopencv_highgui.so.3.3
   libopencv_videoio.so.3.3
   libopencv_imgcodecs.so.3.3
   libopencv_video.so.3.3
   libopencv_photo.so.3.3
   libopencv_imgproc.so.3.3
   libopencv_flann.so.3.3
   libopencv_core.so.3.3
   libstdc++.so.6
   libm.so.6
   libgcc_s.so.1
   libpthread.so.0
   libc.so.6
   ld-linux-armhf.so.3
   libopenblas.a
   liblapack.a
   
   ## Error Message:
   ```
   ======================================================================
   FAIL: test_ndarray.test_ndarray_slice
   ----------------------------------------------------------------------
   Traceback (most recent call last):
     File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
       self.test(*self.arg)
     File "/home/pi/deepgreen/mxnet/tests/python/unittest/test_ndarray.py", 
line 290, in test_ndarray_slice
       assert same(A[1,3:4,:,1:5].asnumpy(), A2[1,3:4,:,1:5])
   AssertionError
   ```
   
   ## Steps to reproduce
   1. Build MXNet on RPi 3 using above configuration. 
   2. Run test_ndarray.py 
(https://github.com/apache/incubator-mxnet/blob/v0.11.0/tests/python/unittest/test_ndarray.py)
   
   ## What have you tried to solve it?
   I tried to find the reason why it failed by executing it line by line in 
python shell. 
   Here's what I got: (the last assertion fails. The two values are different)
   ```
   >>> import mxnet as mx
   >>> import numpy as np
   >>> np.version.version
   '1.13.3'
   >>> from mxnet.test_utils import *
   >>> shape = (10,)
   >>> A = mx.nd.array(np.random.uniform(-10, 10, shape))
   >>> A2 = A.asnumpy()
   >>> same(A[3:8].asnumpy(), A2[3:8])
   True
   >>> A2[3:8] *= 10;
   >>> A[3:8] = A2[3:8]
   >>> same(A[3:8].asnumpy(), A2[3:8])
   True
   >>> shape = (3,4,5,6,7)
   >>> A = mx.nd.random_uniform(shape=shape)
   >>> A2 = A.asnumpy()
   >>> same(A[1,3:4,:,1:5].asnumpy(), A2[1,3:4,:,1:5])
   False
   >>> A[1,3:4,:,1:5].asnumpy()
   array([[[[ 0.58543205,  0.97073144,  0.74683636,  0.00386035,  0.60898864,
              0.17857997,  0.5790112 ],
            [ 0.61286676,  0.17009965,  0.08136959,  0.68636203,  0.8818965 ,
              0.97680181,  0.71962017],
            [ 0.60859329,  0.96638995,  0.32837895,  0.50763553,  0.80269212,
              0.30040368,  0.83636403],
            [ 0.54950058,  0.41527995,  0.93081874,  0.41560826,  0.52076143,
              0.93661714,  0.26720703]],
   
           [[ 0.36446267,  0.44458729,  0.66771489,  0.33610228,  0.57184362,
              0.88067812,  0.77468348],
            [ 0.94502676,  0.90010214,  0.99189031,  0.40430653,  0.37674126,
              0.89534509,  0.96614742],
            [ 0.06508248,  0.79187959,  0.68547738,  0.67568916,  0.23107006,
              0.24488948,  0.53886849],
            [ 0.21645726,  0.77303499,  0.16604783,  0.7465843 ,  0.92275661,
              0.72143012,  0.29407665]],
   
           [[ 0.0789699 ,  0.81803328,  0.72687799,  0.10241375,  0.97542411,
              0.15638335,  0.78208935],
            [ 0.30419868,  0.24704522,  0.07535907,  0.03656099,  0.42466301,
              0.40692192,  0.10761771],
            [ 0.87775081,  0.56821758,  0.43199378,  0.24655694,  0.28408614,
              0.59643304,  0.9353019 ],
            [ 0.11752564,  0.77226555,  0.97588384,  0.61098653,  0.93256122,
              0.00267707,  0.39179695]],
   
           [[ 0.70514756,  0.80936497,  0.59606498,  0.70903546,  0.53723568,
              0.95433384,  0.45557857],
            [ 0.35193625,  0.6001932 ,  0.89754277,  0.65408194,  0.7699672 ,
              0.37303978,  0.35742465],
            [ 0.66823399,  0.62166542,  0.45688465,  0.28856996,  0.0850668 ,
              0.8743999 ,  0.23317376],
            [ 0.11242732,  0.08137172,  0.21243437,  0.32201734,  0.18303329,
              0.61132741,  0.40302601]],
   
           [[ 0.34835675,  0.93239397,  0.08824824,  0.21539821,  0.60222918,
              0.85833764,  0.71437573],
            [ 0.8028934 ,  0.15722209,  0.15914623,  0.34213752,  0.60571194,
              0.72724992,  0.11566187],
            [ 0.66331792,  0.72788817,  0.85446   ,  0.63746226,  0.5546034 ,
              0.81193858,  0.02575646],
            [ 0.47938454,  0.05732062,  0.91486311,  0.08006109,  0.04934895,
              0.51713729,  0.29288855]]]], dtype=float32)
   >>> A2[1,3:4,:,1:5]
   array([[[[ 0.39554381,  0.15984529,  0.23307782,  0.04680635,  0.58543205,
              0.97073144,  0.74683636],
            [ 0.00386035,  0.60898864,  0.17857997,  0.5790112 ,  0.61286676,
              0.17009965,  0.08136959],
            [ 0.68636203,  0.8818965 ,  0.97680181,  0.71962017,  0.60859329,
              0.96638995,  0.32837895],
            [ 0.50763553,  0.80269212,  0.30040368,  0.83636403,  0.54950058,
              0.41527995,  0.93081874]],
   
           [[ 0.57521248,  0.85877746,  0.64367807,  0.45850316,  0.36446267,
              0.44458729,  0.66771489],
            [ 0.33610228,  0.57184362,  0.88067812,  0.77468348,  0.94502676,
              0.90010214,  0.99189031],
            [ 0.40430653,  0.37674126,  0.89534509,  0.96614742,  0.06508248,
              0.79187959,  0.68547738],
            [ 0.67568916,  0.23107006,  0.24488948,  0.53886849,  0.21645726,
              0.77303499,  0.16604783]],
   
           [[ 0.97498983,  0.42690435,  0.30082393,  0.84285492,  0.0789699 ,
              0.81803328,  0.72687799],
            [ 0.10241375,  0.97542411,  0.15638335,  0.78208935,  0.30419868,
              0.24704522,  0.07535907],
            [ 0.03656099,  0.42466301,  0.40692192,  0.10761771,  0.87775081,
              0.56821758,  0.43199378],
            [ 0.24655694,  0.28408614,  0.59643304,  0.9353019 ,  0.11752564,
              0.77226555,  0.97588384]],
   
           [[ 0.92740256,  0.4083029 ,  0.69315279,  0.37740657,  0.70514756,
              0.80936497,  0.59606498],
            [ 0.70903546,  0.53723568,  0.95433384,  0.45557857,  0.35193625,
              0.6001932 ,  0.89754277],
            [ 0.65408194,  0.7699672 ,  0.37303978,  0.35742465,  0.66823399,
              0.62166542,  0.45688465],
            [ 0.28856996,  0.0850668 ,  0.8743999 ,  0.23317376,  0.11242732,
              0.08137172,  0.21243437]],
   
           [[ 0.06443545,  0.06355378,  0.26433277,  0.20825325,  0.34835675,
              0.93239397,  0.08824824],
            [ 0.21539821,  0.60222918,  0.85833764,  0.71437573,  0.8028934 ,
              0.15722209,  0.15914623],
            [ 0.34213752,  0.60571194,  0.72724992,  0.11566187,  0.66331792,
              0.72788817,  0.85446   ],
            [ 0.63746226,  0.5546034 ,  0.81193858,  0.02575646,  0.47938454,
              0.05732062,  0.91486311]]]], dtype=float32)
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to