dwSun commented on issue #10807: Ndarray.asnumpy() error with gluon dense under both GPU and CPU environment URL: https://github.com/apache/incubator-mxnet/issues/10807#issuecomment-386549085 modified your script as this: ```py from mxnet.gluon import nn import mxnet as mx mx.Context.default_ctx = mx.Context('cpu', 0) layer = nn.Dense(1000) x = mx.nd.random.uniform(shape=(16, 128, 300, 300)) x.attach_grad() layer.collect_params().initialize() with mx.autograd.record(): out = layer(x) out.backward() print(x.grad.shape) print(x.grad) print(x.grad.asnumpy().shape) ``` with mxnet-mkl 1.1.0 from pypi, I got this: ``` % python3 script.py 134 ↵ (16, 128, 300, 300) terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc [1] 17413 abort python3 script.py ``` with mxnet-mkl 1.2.0b20180503 from pypi, I got this: ``` % python3 script.py 1 ↵ (16, 128, 300, 300) Traceback (most recent call last): File "script.py", line 14, in <module> print(x.grad) File "/home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 189, in __repr__ return '\n%s\n<%s %s @%s>' % (str(self.asnumpy()), File "/home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 1876, in asnumpy ctypes.c_size_t(data.size))) File "/home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/base.py", line 149, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: [17:24:12] src/storage/./cpu_device_storage.h:73: Failed to allocate CPU Memory Stack trace returned 10 entries: [bt] (0) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x17009d) [0x7f39de8c009d] [bt] (1) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x170468) [0x7f39de8c0468] [bt] (2) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2dc701d) [0x7f39e151701d] [bt] (3) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2dc704d) [0x7f39e151704d] [bt] (4) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2dcc77b) [0x7f39e151c77b] [bt] (5) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x29140f4) [0x7f39e10640f4] [bt] (6) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x291469f) [0x7f39e106469f] [bt] (7) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2914ab0) [0x7f39e1064ab0] [bt] (8) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2891843) [0x7f39e0fe1843] [bt] (9) /home/david/.virtualenvs/mkl-dnn/local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2899644) [0x7f39e0fe9644] ``` So, I am totally confused...
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
