Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[Numpy] mxnet.np.dtype() falls back to official NumPy function numpy.vander() #19454

Closed
barry-jin opened this issue Oct 30, 2020 · 1 comment
Closed

Comments

@barry-jin
Copy link
Contributor

barry-jin commented Oct 30, 2020

Description

Calling mxnet.np.dtype() will fall back to official NumPy function numpy.vander() rather than numpy.dtype().

Error Message

>>> import numpy as _np
>>> from mxnet import np
>>> _np.dtype(np.float32)
dtype('float32')
>>> np.dtype(np.float32)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.6/site-packages/mxnet/numpy/fallback.py", line 121, in fn
    return onp_obj(*args, **kwargs)
  File "<__array_function__ internals>", line 6, in vander
  File "/usr/local/lib/python3.6/dist-packages/numpy/lib/twodim_base.py", line 546, in vander
    x = asarray(x)
  File "/usr/local/lib/python3.6/dist-packages/numpy/core/_asarray.py", line 83, in asarray
    return array(a, dtype, copy=False, order=order)
ValueError: invalid __array_struct__
>>> from mxnet import np
>>> x = np.array([1, 2, 3, 5])
[17:27:08] ../src/storage/storage.cc:199: Using Pooled (Naive) StorageManager for CPU
>>> np.dtype(x, 3)
WARNING:root:np.vander is a fallback operator, which is actually using official numpy's implementation.
array([[ 1.,  1.,  1.],
       [ 4.,  2.,  1.],
       [ 9.,  3.,  1.],
       [25.,  5.,  1.]], dtype=float64)

To Reproduce

>>> from mxnet import np
>>> np.dtype(np.float32)

What have you tried to solve it?

Environment

We recommend using our script for collecting the diagnostic information with the following command
curl --retry 10 -s https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py | python3

Environment Information
cubator-mxnet/master/tools/diagnose.py | python3
----------Python Info----------
Version      : 3.6.9
Compiler     : GCC 8.4.0
Build        : ('default', 'Oct  8 2020 12:12:24')
Arch         : ('64bit', 'ELF')
------------Pip Info-----------
Version      : 20.2.3
Directory    : /usr/local/lib/python3.6/dist-packages/pip
----------MXNet Info-----------
Version      : 2.0.0
Directory    : /home/ubuntu/.local/lib/python3.6/site-packages/mxnet
Commit hash file "/home/ubuntu/.local/lib/python3.6/site-packages/mxnet/COMMIT_HASH" not found. Not installed from pre-built package or built from source.
Library      : ['/home/ubuntu/.local/lib/python3.6/site-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
✔ MKLDNN
✔ OPENCV
✔ DIST_KVSTORE
✖ INT64_TENSOR_SIZE
✔ SIGNAL_HANDLER
✖ DEBUG
✖ TVM_OP
----------System Info----------
Platform     : Linux-5.4.0-1025-aws-x86_64-with-Ubuntu-18.04-bionic
system       : Linux
node         : ip-172-31-10-57
release      : 5.4.0-1025-aws
version      : #25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020
----------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:               85
Model name:          Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
Stepping:            7
CPU MHz:             3177.532
BogoMIPS:            4999.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            1024K
L3 cache:            36608K
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 mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves ida arat pku ospke avx512_vnni
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0020 sec, LOAD: 0.4750 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0520 sec, LOAD: 0.2822 sec.
Error open Gluon Tutorial(cn): https://zh.gluon.ai, <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>, DNS finished in 0.11438822746276855 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0195 sec, LOAD: 0.1837 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0641 sec, LOAD: 0.2075 sec.
Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403: Forbidden, DNS finished in 0.03410220146179199 sec.
----------Environment----------
KMP_DUPLICATE_LIB_OK="True"
KMP_INIT_AT_FORK="FALSE"
@barry-jin barry-jin changed the title [BUG] mxnet.np.dtype() falls back to official NumPy function numpy.vander() mxnet.np.dtype() falls back to official NumPy function numpy.vander() Oct 30, 2020
@barry-jin barry-jin changed the title mxnet.np.dtype() falls back to official NumPy function numpy.vander() [Numpy] mxnet.np.dtype() falls back to official NumPy function numpy.vander() Oct 30, 2020
@barry-jin
Copy link
Contributor Author

It looks like some other mxnet numpy operators in mxnet/numpy/fallback.py also fall back to official numpy.vander().

>>> from mxnet import np
>>> np.dtype([3.2, 2, 1])
array([[10.24,  3.2 ,  1.  ],
       [ 4.  ,  2.  ,  1.  ],
       [ 1.  ,  1.  ,  1.  ]])
>>> np.min_scalar_type([3.2, 2, 1])
array([[10.24,  3.2 ,  1.  ],
       [ 4.  ,  2.  ,  1.  ],
       [ 1.  ,  1.  ,  1.  ]])
>>> np.choose([3.2, 2, 1])
array([[10.24,  3.2 ,  1.  ],
       [ 4.  ,  2.  ,  1.  ],
       [ 1.  ,  1.  ,  1.  ]])
>>> np.roots([3.2, 2, 1])
array([[10.24,  3.2 ,  1.  ],
       [ 4.  ,  2.  ,  1.  ],
       [ 1.  ,  1.  ,  1.  ]])

barry-jin added a commit to barry-jin/incubator-mxnet that referenced this issue Oct 30, 2020
@leezu leezu closed this as completed in 9625f8f Nov 17, 2020
josephevans pushed a commit to josephevans/mxnet that referenced this issue Feb 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants