AustinDoolittle opened a new issue #18681:
URL: https://github.com/apache/incubator-mxnet/issues/18681


   ## Description
   When trying to move a tensor of size 0 to a different context than the 
context that it is currently on, an "inferring shapes failed" error is raised. 
This occurs for tensors regardless of the number of dimensions they contain. It 
seems that inferring the shape of an empty NDArray is not currently possible.
   
   ### Error Message
   ```
   Traceback (most recent call last):
     File "<redacted>/recreate_shape_bug.py", line 7, in <module>
       new_array = empty_array.as_in_context(mx.cpu())
     File "<redacted>/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 
2144, in as_in_context
       return self.copyto(context)
     File "<redacted>/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 
2093, in copyto
       return _internal._copyto(self, out=hret)
     File "<string>", line 25, in _copyto
     File "<redacted>/python3.6/site-packages/mxnet/_ctypes/ndarray.py", line 
92, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File "<redacted>/python3.6/site-packages/mxnet/base.py", line 253, in 
check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [18:43:30] 
<redacted>/src/imperative/./imperative_utils.h:145: Operator _copyto inferring 
shapes failed.
   input shapes:
   [-1]
   output shapes:
   [-1]
   operator attributes:
   
   Stack trace:
     [bt] (0) 
<redacted>/lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x24) 
[0x7fe5f79ba534]
     [bt] (1) 
<redacted>/lib/libmxnet.so(mxnet::imperative::SetShapeType(mxnet::Context 
const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, mxnet::DispatchMode*)+0x1dd5) 
[0x7fe5f983c1e5]
     [bt] (2) 
<redacted>/lib/libmxnet.so(mxnet::Imperative::Invoke(mxnet::Context const&, 
nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&)+0x297) [0x7fe5f98300c7]
     [bt] (3) <redacted>/lib/libmxnet.so(MXImperativeInvokeImpl(void*, int, 
void**, int*, void***, int, char const**, char const**)+0x5e5) [0x7fe5f973c995]
     [bt] (4) <redacted>/lib/libmxnet.so(MXImperativeInvokeEx+0x67) 
[0x7fe5f973dd27]
     [bt] (5) 
<redacted>/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c)
 [0x7fe622ba3ef8]
     [bt] (6) 
<redacted>/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(ffi_call+0x15f)
 [0x7fe622ba2fff]
     [bt] (7) 
<redacted>/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x292)
 [0x7fe622b9ae02]
     [bt] (8) 
<redacted>/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(+0xa08b)
 [0x7fe622b9208b]
   ```
   
   ## To Reproduce
   Code to reproduce is as follows
   ```
   import mxnet as mx
   
   empty_array = mx.nd.array([], ctx=mx.Context('cpu_shared', 0))
   new_array = empty_array.as_in_context(mx.cpu())
   ```
   
   ### Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1. Run above code as-is 
   
   ## What have you tried to solve it?
   
   1. Attempted with tensors of >1 dimension, but got the same result.
   
   ## Environment
   Python: 3.6.10
   MXNet: 1.6.1
   
   


----------------------------------------------------------------
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


Reply via email to