diff --git a/python/mxnet/numpy/multiarray.py b/python/mxnet/numpy/multiarray.py index 4af51fc5bf3a..bc4b409d5be7 100644 --- a/python/mxnet/numpy/multiarray.py +++ b/python/mxnet/numpy/multiarray.py @@ -1996,13 +1996,16 @@ def array(object, dtype=None, ctx=None): if isinstance(object, (ndarray, _np.ndarray)): dtype = object.dtype if dtype is None else dtype elif isinstance(object, NDArray): - raise ValueError("") + raise ValueError("If you're trying to create a mxnet.numpy.ndarray " + "from mx.nd.NDArray, please use the zero-copy as_np_ndarray function.") else: if dtype is None: dtype = object.dtype if hasattr(object, "dtype") else _np.float32 try: object = _np.array(object, dtype=dtype) except Exception as e: + # printing out the error raised by official NumPy's array function + # for transparency on users' side raise TypeError('{}'.format(str(e))) ret = empty(object.shape, dtype=dtype, ctx=ctx) if len(object.shape) == 0: diff --git a/tests/python/unittest/test_numpy_op.py b/tests/python/unittest/test_numpy_op.py index 1a8ec9f60928..0b15c7ea0d2d 100644 --- a/tests/python/unittest/test_numpy_op.py +++ b/tests/python/unittest/test_numpy_op.py @@ -442,7 +442,7 @@ def is_int(dtype): for axis in ([i for i in range(in_data_dim)] + [(), None]): for itype in ['float16', 'float32', 'float64', 'int8', 'int32', 'int64', 'bool']: for dtype in ['float16', 'float32', 'float64', 'int8', 'int32', 'int64']: - if (is_int(dtype) and not is_int(itype))\ + if (is_int(dtype) and not is_int(itype)) or (is_windows and is_int(itype))\ or (itype == 'bool' and\ (dtype not in ('float32', 'float64', 'int32', 'int64') or is_windows)): continue