You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/07/11 18:50:02 UTC

[GitHub] [incubator-mxnet] EnricoMi opened a new issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

EnricoMi opened a new issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442


   ## Description
   One of our [MXNet tests in Horovod](https://github.com/horovod/horovod/blob/master/test/parallel/test_mxnet.py#L721) started to fail on the nightly packages after 2021-06-20. Can you please point me to any breaking changes around that time that might cause this error and need some adoption on our side?
   
       TypeError: Block's inputs must be of type `mxnet.numpy.ndarray`, while got output type <class 'mxnet.ndarray.ndarray.NDArray'>
   
   ### Error Message
   ```
       def test_horovod_broadcast_deferred_init_parameters(self):
           """Test that the deferred initialized parameters are broadcasted."""
           hvd.init()
           root_rank = 0
           rank = hvd.rank()
       
           # This test does not apply if there is only one worker.
           if hvd.size() == 1:
               self.skipTest("Only one worker available")
       
           mx.random.seed(rank)
           layer = mx.gluon.nn.Conv2D(10, 2)
           layer.initialize()
           hvd.broadcast_parameters(layer.collect_params(), root_rank=root_rank)
       
           x = mx.nd.ones((5, 4, 10, 10))
   >       layer(x)
   
   test_mxnet.py:737: 
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   /usr/local/lib/python3.8/dist-packages/mxnet/util.py:299: in _with_np_shape
       return func(*args, **kwargs)
   /usr/local/lib/python3.8/dist-packages/mxnet/util.py:481: in _with_np_array
       return func(*args, **kwargs)
   /usr/local/lib/python3.8/dist-packages/mxnet/gluon/block.py:1578: in __call__
       _check_block_input_np_ndarrays([x, *args])
   /usr/local/lib/python3.8/dist-packages/mxnet/gluon/utils.py:505: in _check_block_input_np_ndarrays
       _check_block_input_np_ndarrays(i)
   _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   
   inputs = 
   [[[[1. 1. 1. ... 1. 1. 1.]
      [1. 1. 1. ... 1. 1. 1.]
      [1. 1. 1. ... 1. 1. 1.]
      ...
      [1. 1. 1. ... 1. 1. 1.]
     ...
      ...
      [1. 1. 1. ... 1. 1. 1.]
      [1. 1. 1. ... 1. 1. 1.]
      [1. 1. 1. ... 1. 1. 1.]]]]
   <NDArray 5x4x10x10 @cpu(0)>
   
       def _check_block_input_np_ndarrays(inputs):
           """Check if block's inputs are numpy ndarrays."""
           from ..numpy import ndarray as np_ndarray
           from ..symbol import Symbol as nd_symbol
           from ..ndarray import NDArray as nd_ndarray
       
           # pylint: disable=no-else-raise
           if isinstance(inputs, (nd_ndarray, nd_symbol)) and not isinstance(inputs, (np_ndarray)):
   >           raise TypeError("Block's inputs must be of type `mxnet.numpy.ndarray`, "
                               "while got output type {}"
   E                           TypeError: Block's inputs must be of type `mxnet.numpy.ndarray`, while got output type <class 'mxnet.ndarray.ndarray.NDArray'>
   ```
   
   ## Environment
   
   <details>
   <summary>Environment Information</summary>
   
   ```
   ----------Python Info----------
   Version      : 3.8.0
   Compiler     : GCC 8.4.0
   Build        : ('default', 'Feb 25 2021 22:10:10')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 21.1.3
   Directory    : /usr/local/lib/python3.8/dist-packages/pip
   ----------MXNet Info-----------
   Version      : 2.0.0
   Directory    : /usr/local/lib/python3.8/dist-packages/mxnet
   Commit hash file "/usr/local/lib/python3.8/dist-packages/mxnet/COMMIT_HASH" not found. Not installed from pre-built package or built from source.
   Library      : ['/usr/local/lib/python3.8/dist-packages/mxnet/libmxnet.so']
   Build features:
   ✖ CUDA
   ✖ CUDNN
   ✖ NCCL
   ✖ TENSORRT
   ✖ CUTENSOR
   ✔ CPU_SSE
   ✔ CPU_SSE2
   ✔ CPU_SSE3
   ✖ CPU_SSE4_1
   ✖ CPU_SSE4_2
   ✖ CPU_SSE4A
   ✖ CPU_AVX
   ✖ CPU_AVX2
   ✔ OPENMP
   ✖ SSE
   ✖ F16C
   ✖ JEMALLOC
   ✔ BLAS_OPEN
   ✖ BLAS_ATLAS
   ✖ BLAS_MKL
   ✖ BLAS_APPLE
   ✔ LAPACK
   ✔ ONEDNN
   ✔ OPENCV
   ✔ DIST_KVSTORE
   ✔ INT64_TENSOR_SIZE
   ✔ SIGNAL_HANDLER
   ✖ DEBUG
   ✖ TVM_OP
   ----------System Info----------
   Platform     : Linux-5.4.0-67-generic-x86_64-with-glibc2.27
   system       : Linux
   node         : 9a4e11949b22
   release      : 5.4.0-67-generic
   version      : #75-Ubuntu SMP Fri Feb 19 18:03:38 UTC 2021
   ----------Hardware Info----------
   machine      : x86_64
   processor    : x86_64
   Architecture:        x86_64
   CPU op-mode(s):      32-bit, 64-bit
   Byte Order:          Little Endian
   CPU(s):              8
   On-line CPU(s) list: 0-7
   Thread(s) per core:  2
   Core(s) per socket:  4
   Socket(s):           1
   NUMA node(s):        1
   Vendor ID:           GenuineIntel
   CPU family:          6
   Model:               158
   Model name:          Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
   Stepping:            9
   CPU MHz:             3536.135
   CPU max MHz:         3800.0000
   CPU min MHz:         800.0000
   BogoMIPS:            5599.85
   Virtualization:      VT-x
   L1d cache:           32K
   L1i cache:           32K
   L2 cache:            256K
   L3 cache:            6144K
   NUMA node0 CPU(s):   0-7
   Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0288 sec, LOAD: 0.5301 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0899 sec, LOAD: 0.6390 sec.
   Error open Gluon Tutorial(cn): https://zh.gluon.ai, <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)>, DNS finished in 5.028506517410278 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0254 sec, LOAD: 0.8350 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0328 sec, LOAD: 0.8642 sec.
   Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403: Forbidden, DNS finished in 0.04214024543762207 sec.
   ----------Environment----------
   ```
   
   </details>
   


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] Zha0q1 commented on issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442#issuecomment-877845123


   @barry-jin 


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] EnricoMi commented on issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
EnricoMi commented on issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442#issuecomment-878803290


   Thanks a lot for the input.


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] barry-jin commented on issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
barry-jin commented on issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442#issuecomment-878485008


   Yes, using `x = mx.np.ones((5, 4, 10, 10))` is still compatible with MXNet 1.x. 


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] EnricoMi commented on issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
EnricoMi commented on issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442#issuecomment-878040627


   Hi @barry-jin, thanks for the quick and precise reply. Is that fix backward compatible with MXNet 1.x?


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] Zha0q1 edited a comment on issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
Zha0q1 edited a comment on issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442#issuecomment-877845123


   https://github.com/apache/incubator-mxnet/pull/20262
   
   @barry-jin is the author of the commit
   


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] EnricoMi closed issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
EnricoMi closed issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442


   


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] barry-jin commented on issue #20442: TypeError: Block's inputs must be of type `mxnet.numpy.ndarray` ...

Posted by GitBox <gi...@apache.org>.
barry-jin commented on issue #20442:
URL: https://github.com/apache/incubator-mxnet/issues/20442#issuecomment-877856959


   Hi @EnricoMi , after #20262 being merged, MXNet2.0 will switch to use Gluon2.0 API and deprecate all the use of legacy NDArrays and ndarray/symbol operators in Gluon Blocks/Layers. In your case, you can just change `x = mx.nd.ones((5, 4, 10, 10))` to `x = mx.np.ones((5, 4, 10, 10))` because in current Gluon2.0, only mxnet.numpy arrays are allowed. 
   For more detailed information, you can follow the migration guide [here](https://hackmd.io/@BarryJin/ryjIgg-2_). 


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

To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org