leleamol commented on issue #15626: Concat of empty array and array with data crashes Mxnet URL: https://github.com/apache/incubator-mxnet/issues/15626#issuecomment-526275636 I could reproduce this issue. As per the call stack below the operator "Concat" fails to infer the shapes. I also noticed that the operator "_zeroes" fails to infer shape when we try to intialize ndarray as follows: m = mx.ndarray.zeros((0,4)) This is already captured in the issue #15766 I am curious to know what is the significance of having "0" as one of the shape dimension? Here is the call stack for "concat" operation ``` >>> mx.nd.concat(a,b, dim=0, k) File "<stdin>", line 1 SyntaxError: positional argument follows keyword argument >>> mx.nd.concat(a,b, dim=0, out=k) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 68, in concat File "/usr/local/lib/python3.7/site-packages/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke ctypes.byref(out_stypes))) File "/usr/local/lib/python3.7/site-packages/mxnet/base.py", line 253, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: [17:44:00] src/imperative/./imperative_utils.h:145: Operator Concat inferring shapes failed. input shapes: [-1,4] [1,4] output shapes: [1,4] operator attributes: num_args : 2 dim : 0 Stack trace: [bt] (0) 1 libmxnet.so 0x0000000112ef8929 mxnet::op::NDArrayOpProp::~NDArrayOpProp() + 4473 [bt] (1) 2 libmxnet.so 0x0000000114477b1f mxnet::imperative::SetShapeType(mxnet::Context const&, nnvm::NodeAttrs const&, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> > const&, mxnet::DispatchMode*) + 8767 [bt] (2) 3 libmxnet.so 0x000000011447483c mxnet::Imperative::Invoke(mxnet::Context const&, nnvm::NodeAttrs const&, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> > const&) + 716 [bt] (3) 4 libmxnet.so 0x00000001143ba48e SetNDInputsOutputs(nnvm::Op const*, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> >*, std::__1::vector<mxnet::NDArray*, std::__1::allocator<mxnet::NDArray*> >*, int, void* const*, int*, int, int, void***) + 1582 [bt] (4) 5 libmxnet.so 0x00000001143bb1d0 MXImperativeInvokeEx + 176 [bt] (5) 6 _ctypes.cpython-37m-darwin.so 0x00000001096b335f ffi_call_unix64 + 79 ``` Based on callstack above, I noticed that the input_shape changed from [0,4] to [-1,4]. When I looked at the code of "Concat" operator, the output "size" for "dim=0" came out to be 0 (as a result of concat of "-1" and "1"). I have limited understanding of this code but this could be the cause of crash.
---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
