You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/05/04 04:53:09 UTC
[GitHub] lionel92 opened a new issue #10807: Asnumpy() error with gluon
dense under both GPU/CPU/MKLDNN environment
lionel92 opened a new issue #10807: Asnumpy() error with gluon dense under both GPU/CPU/MKLDNN environment
URL: https://github.com/apache/incubator-mxnet/issues/10807
## Description
I try to use gluon API to test mkldnn while an error occurs when do asnumpy() operation after the network's backward propogation. So I performed the test under gpu and native cpu environment, and the error still exists.
You can run the following mininum example to reproduce the error.
```
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn
from mxnet.test_utils import assert_almost_equal
from common import setup_module, with_seed
import numpy as np
import random
from nose.tools import raises
#mx.Context.default_ctx = mx.Context('gpu', 0)
mx.Context.default_ctx = mx.Context('cpu', 0)
layer = nn.Dense(1000)
x = mx.nd.random.uniform(shape=(16, 128, 300, 300))
#x = mx.nd.random.uniform(shape=(1, 2, 30, 30))
x.attach_grad()
layer.collect_params().initialize()
with mx.autograd.record():
out = layer(x)
out.backward()
print x.grad.shape
print x.grad.asnumpy().shape
```
Error message:
print x.grad.asnumpy().shape
File "/home/linliu/mxnet_gpu/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 1876, in asnumpy
ctypes.c_size_t(data.size)))
File "/home/linliu/mxnet_gpu/incubator-mxnet/python/mxnet/base.py", line 149, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: ([04:25:06] include/mxnet/././tensor_blob.h:257: Check failed: this->shape_.Size() == shape.Size() (11520000000 vs. 2930065408) TBlob.get_with_shape: new and old shape do not match total elements
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services