-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[Bug][Numpy] Very basic functionality of Gluon is broken #18193
Comments
Assignee: @JiangZhaoh |
Sorry for that. I'll fix it as soon as possible. |
which tests were supposed to catch this issue? |
@szha For example, https://github.com/apache/incubator-mxnet/blob/73d1b055d04a0f0f511a9cc2dd46ae2eb03a8628/tests/python/unittest/test_numpy_gluon.py#L382-L411 I think there are tests in |
That's my issue. In order to not effect original tests, I didn't change the decorator "use_np", which still use |
OK, so this is not related to CI. |
I have found the reason. It because
So, I think I'd better not to set |
I think one of the root cause is that gluon optimizer and initializer are still using the legacy NDArray. We should fix that.
Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: JiangZhaoh <[email protected]>
Sent: Wednesday, April 29, 2020 7:37:14 PM
To: apache/incubator-mxnet <[email protected]>
Cc: Xingjian SHI <[email protected]>; Author <[email protected]>
Subject: Re: [apache/incubator-mxnet] [Bug][Numpy] Very basic functionality of Gluon is broken (#18193)
I have found the reason. It because set_np() only change the mxnet.numpy functions to default dtype as float64, but doesn't effect mxnet.ndarray functions which still default float32.
The issue mentioned above just like this code:
>> import mxnet
>> from mxnet import numpy as np
>> from mxnet import ndarray as nd
>> from mxnet import npx
>> npx.set_np()
>> a = nd.zeros(5)
>> a.dtype
<class 'numpy.float32'>
>> np.random.uniform(low = -1, high = 1, size = (5), out = a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ubuntu/mxnet/python/mxnet/numpy/random.py", line 137, in uniform
return _mx_nd_np.random.uniform(low, high, size=size, ctx=ctx, dtype=dtype, out=out)
File "/home/ubuntu/mxnet/python/mxnet/ndarray/numpy/random.py", line 145, in uniform
return _api_internal.uniform(low, high, size, ctx, dtype, out)
File "mxnet/_ffi/_cython/./function.pxi", line 188, in mxnet._ffi._cy3.core.FunctionBase.__call__
File "mxnet/_ffi/_cython/./function.pxi", line 133, in mxnet._ffi._cy3.core.FuncCall
File "mxnet/_ffi/_cython/./base.pxi", line 90, in mxnet._ffi._cy3.core.CALL
mxnet.base.MXNetError: Traceback (most recent call last):
File "../src/imperative/./imperative_utils.h", line 251
MXNetError: Check failed: outputs[i]->dtype() == out_types[i] (0 vs. 1) : 0-th output has invalid dtype. Expecting 1 got 0 in operator _npi_uniform
>> npx.set_np(dtype = False)
>> np.random.uniform(low = -1, high = 1, size = (5), out = a)
[0.09762704 0.18568921 0.43037868 0.6885315 0.20552671]
<NDArray 5 @cpu(0)>
So, I think I'd better not to set dtype=True flag in npx.set_np(), seperate this flag along in a single function npx.set_numpy_default_dtype() instead. Or if there any other better solutions, please tell me.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#18193 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHQH3R5XJLVP76L7A6LBD3RPDP5VANCNFSM4MT3GKPQ>.
|
should be resolved by #18200 |
After #17283, the following very basic example of gluon is broken:
The text was updated successfully, but these errors were encountered: