anirudhacharya edited a comment on issue #9166: Segfault on ndarray with 
negative dimension i.e. mxnet.nx.zeros((-1,))
URL: 
https://github.com/apache/incubator-mxnet/issues/9166#issuecomment-470283142
 
 
   with the latest version of mxnet, the above command neither causes core dump 
or Segmentation fault. 
   When I try to pass `-1` as shape in python2 and python3, I get the following 
stack trace.
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/ndarray/utils.py",
 line 67, in zeros
       return _zeros_ndarray(shape, ctx, dtype, **kwargs)
     File 
"/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/ndarray/ndarray.py",
 line 3822, in zeros
       return _internal._zeros(shape=shape, ctx=ctx, dtype=dtype, **kwargs)
     File "<string>", line 34, in _zeros
     File 
"/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/_ctypes/ndarray.py",
 line 92, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File 
"/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/base.py", 
line 252, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [21:21:58] src/storage/./cpu_device_storage.h:74: 
Failed to allocate CPU Memory
   
   Stack trace returned 10 entries:
   [bt] (0) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(dmlc::StackTrace[abi:cxx11]()+0x1bc)
 [0x7f761aea978c]
   [bt] (1) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x28)
 [0x7f761aeaab08]
   [bt] (2) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(+0x396d71d)
 [0x7f761e26e71d]
   [bt] (3) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(mxnet::storage::NaiveStorageManager<mxnet::storage::CPUDeviceStorage>::Alloc(mxnet::Storage::Handle*)+0xd)
 [0x7f761e26e74d]
   [bt] (4) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(mxnet::StorageImpl::Alloc(mxnet::Storage::Handle*)+0x5b)
 [0x7f761e269efb]
   [bt] (5) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(mxnet::NDArray::CheckAndAlloc()
 const+0x98d) [0x7f761aeab59d]
   [bt] (6) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(mxnet::imperative::PushFCompute(std::function<void
 (nnvm::NodeAttrs const&, mxnet::OpContext const&, std::vector<mxnet::TBlob, 
std::allocator<mxnet::TBlob> > const&, std::vector<mxnet::OpReqType, 
std::allocator<mxnet::OpReqType> > const&, std::vector<mxnet::TBlob, 
std::allocator<mxnet::TBlob> > const&)> const&, nnvm::Op const*, 
nnvm::NodeAttrs const&, mxnet::Context const&, std::vector<mxnet::engine::Var*, 
std::allocator<mxnet::engine::Var*> > const&, std::vector<mxnet::engine::Var*, 
std::allocator<mxnet::engine::Var*> > const&, std::vector<mxnet::Resource, 
std::allocator<mxnet::Resource> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<unsigned int, 
std::allocator<unsigned int> > const&, std::vector<mxnet::OpReqType, 
std::allocator<mxnet::OpReqType> > 
const&)::{lambda(mxnet::RunContext)#1}::operator()(mxnet::RunContext) 
const+0xd88) [0x7f761db1a308]
   [bt] (7) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(std::_Function_handler<void
 (mxnet::RunContext), mxnet::imperative::PushFCompute(std::function<void 
(nnvm::NodeAttrs const&, mxnet::OpContext const&, std::vector<mxnet::TBlob, 
std::allocator<mxnet::TBlob> > const&, std::vector<mxnet::OpReqType, 
std::allocator<mxnet::OpReqType> > const&, std::vector<mxnet::TBlob, 
std::allocator<mxnet::TBlob> > const&)> const&, nnvm::Op const*, 
nnvm::NodeAttrs const&, mxnet::Context const&, std::vector<mxnet::engine::Var*, 
std::allocator<mxnet::engine::Var*> > const&, std::vector<mxnet::engine::Var*, 
std::allocator<mxnet::engine::Var*> > const&, std::vector<mxnet::Resource, 
std::allocator<mxnet::Resource> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<unsigned int, 
std::allocator<unsigned int> > const&, std::vector<mxnet::OpReqType, 
std::allocator<mxnet::OpReqType> > 
const&)::{lambda(mxnet::RunContext)#1}>::_M_invoke(std::_Any_data const&, 
mxnet::RunContext&&)+0x17) [0x7f761db1a9c7]
   [bt] (8) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(std::_Function_handler<void
 (mxnet::RunContext, mxnet::engine::CallbackOnComplete), 
mxnet::Engine::PushSync(std::function<void (mxnet::RunContext)>, 
mxnet::Context, std::vector<mxnet::engine::Var*, 
std::allocator<mxnet::engine::Var*> > const&, std::vector<mxnet::engine::Var*, 
std::allocator<mxnet::engine::Var*> > const&, mxnet::FnProperty, int, char 
const*)::{lambda(mxnet::RunContext, 
mxnet::engine::CallbackOnComplete)#1}>::_M_invoke(std::_Any_data const&, 
mxnet::RunContext&&, mxnet::engine::CallbackOnComplete&&)+0x5e) [0x7f761da9eb8e]
   [bt] (9) 
/usr/local/lib/python2.7/dist-packages/mxnet-1.5.0-py2.7.egg/mxnet/libmxnet.so(mxnet::engine::NaiveEngine::PushAsync(std::function<void
 (mxnet::RunContext, mxnet::engine::CallbackOnComplete)>, mxnet::Context, 
std::vector<mxnet::engine::Var*, std::allocator<mxnet::engine::Var*> > const&, 
std::vector<mxnet::engine::Var*, std::allocator<mxnet::engine::Var*> > const&, 
mxnet::FnProperty, int, char const*, bool)+0x20c) [0x7f761e24393c]
   ```
   
   Based on this, I think this issue can be closed.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to