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/02/22 00:53:38 UTC

[GitHub] ChaiBapchya opened a new issue #14227: MXNet Ndarray initialization with constant scalar inconsistencies

ChaiBapchya opened a new issue #14227: MXNet Ndarray initialization with constant scalar inconsistencies
URL: https://github.com/apache/incubator-mxnet/issues/14227
 
 
   **Iniitializing MXNet NDArray with constant as a list**
   This is valid
   ```
   >>> b=mx.nd.array([2**25])
   >>> a=mx.nd.array([np.array(2**25)])
   >>> a==b
   
   [1.]
   <NDArray 1 @cpu(0)>
   ```
   
   **Iniitializing MXNet NDArray with constant as a scalar**
   However, this is not. Gives an infershape error.
   ```
   >>> a=mx.nd.array(np.array(2**25))
   >>> b=mx.nd.array(2**25)
   >>> a==b
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/Users/chaitanyabapat/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 326, in __eq__
       return equal(self, other)
     File "/Users/chaitanyabapat/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 3182, in equal
       None)
     File "/Users/chaitanyabapat/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 2641, in _ufunc_helper
       return fn_array(lhs, rhs)
     File "<string>", line 46, in broadcast_equal
     File "/Users/chaitanyabapat/workspace/incubator-mxnet/python/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File "/Users/chaitanyabapat/workspace/incubator-mxnet/python/mxnet/base.py", line 252, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [19:44:28] src/imperative/./imperative_utils.h:124: Check failed: infershape[attrs.op](attrs, &in_shapes, &out_shapes) 
   
   Stack trace returned 8 entries:
   [bt] (0) 0   libmxnet.so                         0x000000011327dced dmlc::StackTrace() + 877
   [bt] (1) 1   libmxnet.so                         0x000000011327d845 dmlc::LogMessageFatal::~LogMessageFatal() + 53
   [bt] (2) 2   libmxnet.so                         0x000000011327c285 dmlc::LogMessageFatal::~LogMessageFatal() + 21
   [bt] (3) 3   libmxnet.so                         0x0000000116263d20 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*) + 5024
   [bt] (4) 4   libmxnet.so                         0x0000000116260d13 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&) + 1491
   [bt] (5) 5   libmxnet.so                         0x0000000115fc6136 MXImperativeInvokeImpl(void*, int, void**, int*, void***, int, char const**, char const**) + 854
   [bt] (6) 6   libmxnet.so                         0x0000000115fc9712 MXImperativeInvokeEx + 178
   [bt] (7) 7   libffi.6.dylib                      0x000000010e661884 ffi_call_unix64 + 76
   
   ```
   PR https://github.com/apache/incubator-mxnet/pull/12678 provided support for importing numpy scalar
   Might be of use

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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