Potential mxnet bugs

I am having a problem with the np module of mxnet.
When trying any arithmetic operation that should raise an Value Error that the operands could not be broadcast together with shapes, there is a segmentation fault (it only happens with the np module of mxnet, with numpy the error is correctly raised)
Is someone experiencing the same problems?

Some context:
MAC OS Mojave 10.14.6
mxnet version 1.6.0b20190915
Python version 3.7.5
(I followed the instalation guide)

The stack trace that the Kernel spits out before restarting:
Segmentation fault: 11

Stack trace:
[bt] (0) 1 libmxnet.so 0x0000000123180740 mxnet::Storage::Get() + 7968
[bt] (1) 2 libsystem_platform.dylib 0x00007fff5e90fb5d _sigtramp + 29
[bt] (2) 3 ??? 0x00007ffee29933a8 0x0 + 140732700111784
[bt] (3) 4 libmxnet.so 0x0000000120c2003e std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, mxnet::NDArrayFunctionReg*>, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, mxnet::NDArrayFunctionReg*>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, mxnet::NDArrayFunctionReg*> > >::destroy(std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, mxnet::NDArrayFunctionReg*>, void*>) + 2542
[bt] (4) 5 libmxnet.so 0x0000000121a88872 mxnet::op::FullyConnectedComputeExCPU(nnvm::NodeAttrs const&, mxnet::OpContext const&, std::__1::vector<mxnet::NDArray, std::__1::allocatormxnet::NDArray > const&, std::__1::vector<mxnet::OpReqType, std::__1::allocatormxnet::OpReqType > const&, std::__1::vector<mxnet::NDArray, std::__1::allocatormxnet::NDArray > const&) + 10964866
[bt] (5) 6 libmxnet.so 0x0000000122aece6f mxnet::imperative::SetShapeType(mxnet::Context const&, nnvm::NodeAttrs const&, std::__1::vector<mxnet::NDArray
, std::__1::allocatormxnet::NDArray* > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&, mxnet::DispatchMode*) + 1583
[bt] (6) 7 libmxnet.so 0x0000000122aeb96c mxnet::Imperative::Invoke(mxnet::Context const&, nnvm::NodeAttrs const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&) + 716
[bt] (7) 8 libmxnet.so 0x0000000122a2e5ce SetNDInputsOutputs(nnvm::Op const*, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* >, std::__1::vector<mxnet::NDArray, std::__1::allocatormxnet::NDArray* >, int, void const*, int*, int, int, void***) + 1582
[bt] (8) 9 libmxnet.so 0x0000000122a2f310 MXImperativeInvokeEx + 176

Hi @gpolo,

Can you also post a small repro code?

Hi @spanev, sure!

import numpy as onp
from mxnet import np, npx
A = np.arange(20).reshape(5,4)
B = np.arange(20).reshape(5,3) # This will cause segmentation fault
C = np.arange(10).reshape(5,2)
A + C # This will cause segmentation fault too
A = onp.arange(20).reshape(5,4)
B = onp.arange(20).reshape(5,3) # This WONT cause segmentation fault but an exception
C = onp.arange(10).reshape(5,2)
A + C # This WONT cause segmentation fault but raise an exception

Hi @spanev,

The problem persist installing all again in a new fresh environment. (I have just tried it)

Thank you very much.

Hi @spanev,

I have solved the problem. I opened an issue on GitHub (incubator-mxnet) and they told me to install the last wheel instead of the version recommended on the course:pip install mxnet --pre.

I dont know if this problem is something that occurs with the 1.6.0b20190915 version in general, just in MAC or what.

1 Like