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 2019/06/13 20:11:28 UTC

[GitHub] [incubator-mxnet] piyushghai opened a new issue #15239: Performing operations on 1-D CSR NDArray results in exception

piyushghai opened a new issue #15239: Performing operations on 1-D CSR NDArray results in exception
URL: https://github.com/apache/incubator-mxnet/issues/15239
 
 
   Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form.
   
   For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io 
   
   ## Description
   It is possible to create 1D CSR NDArray in MXNet, but performing operation on them results in an exception. The backend checks and expects the shape of the ndarray to be 2D, but it crashes when it sees 1D shape. A fix would be to prevent the creation of 1D CSR NDArrays. 
   
   
   Package used (Python/R/Scala/Julia):
   (I'm using Python)
   
   
   ## Error Message:
   ```
   src/operator/tensor/./cast_storage-inl.h:238: Check failed: dns.shape_.ndim() == 2 (1 vs. 2) 
   
   Stack trace returned 10 entries:
   [bt] (0) 0   libmxnet.so                         0x000000010afb0c90 std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*> > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*>, void*>*) + 2736
   [bt] (1) 1   libmxnet.so                         0x000000010afb0a3f std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*> > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, mxnet::NDArrayFunctionReg*>, void*>*) + 2143
   [bt] (2) 2   libmxnet.so                         0x000000010b5f40bd mxnet::op::CastStorageDnsCsrImpl(mxnet::OpContext const&, mshadow::cpu const&, mxnet::TBlob const&, mxnet::NDArray*) + 1709
   [bt] (3) 3   libmxnet.so                         0x000000010b5eb9c9 void mxnet::op::CastStorageComputeImpl<mshadow::cpu>(mxnet::OpContext const&, mxnet::NDArray const&, mxnet::NDArray const&) + 521
   [bt] (4) 4   libmxnet.so                         0x000000010c658377 mxnet::imperative::PushFComputeEx(std::__1::function<void (nnvm::NodeAttrs const&, mxnet::OpContext const&, std::__1::vector<mxnet::NDArray, std::__1::allocator<mxnet::NDArray> > const&, std::__1::vector<mxnet::OpReqType, std::__1::allocator<mxnet::OpReqType> > const&, std::__1::vector<mxnet::NDArray, std::__1::allocator<mxnet::NDArray> > const&)> const&, nnvm::Op const*, nnvm::NodeAttrs const&, mxnet::Context const&, std::__1::vector<mxnet::engine::Var*, std::__1::allocator<mxnet::engine::Var*> > const&, std::__1::vector<mxnet::engine::Var*, std::__1::allocator<mxnet::engine::Var*> > const&, std::__1::vector<mxnet::Resource, std::__1::allocator<mxnet::Resource> > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> > const&, std::__1::vector<mxnet::OpReqType, std::__1::allocator<mxnet::OpReqType> > const&)::'lambda'(mxnet::RunContext)::operator()(mxnet::RunContext) const + 215
   [bt] (5) 5   libmxnet.so                         0x000000010c5d3444 mxnet::Engine::Get() + 34308
   [bt] (6) 6   libmxnet.so                         0x000000010c5d5a48 mxnet::Engine::Get() + 44040
   [bt] (7) 7   libmxnet.so                         0x000000010c5d8b81 std::__1::shared_ptr<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)0> > mxnet::common::LazyAllocArray<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)0> >::Get<mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*, bool)::'lambda2'()>(int, mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*, bool)::'lambda2'()) + 2145
   [bt] (8) 8   libmxnet.so                         0x000000010c5d8a9f std::__1::shared_ptr<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)0> > mxnet::common::LazyAllocArray<mxnet::engine::ThreadedEnginePerDevice::ThreadWorkerBlock<(dmlc::ConcurrentQueueType)0> >::Get<mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*, bool)::'lambda2'()>(int, mxnet::engine::ThreadedEnginePerDevice::PushToExecute(mxnet::engine::OprBlock*, bool)::'lambda2'()) + 1919
   [bt] (9) 9   libmxnet.so                         0x000000010c5d6755 mxnet::Engine::Get() + 47381
   ```
   
   ## Minimum reproducible example
   ```
   In [3]: f = mx.nd.array([1, 2]).tostype('csr')
   
   In [4]: f
   Out[4]: 
   
   <CSRNDArray 2 @cpu(0)>
   
   In [5]: f.data #crashes here
   ```
   
   ## What have you tried to solve it?
   I'll raise a PR to fix this. This issue was created because #13193  had surfaced this. 
   13193 tracks the issue with elemwise_mul operator, while this issue tracks the exception on accessing data from 1D CSR.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services