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 2018/09/26 22:25:54 UTC

[GitHub] ChaiBapchya opened a new issue #12676: Mismatched Shapes in Value Error

ChaiBapchya opened a new issue #12676: Mismatched Shapes in Value Error
URL: https://github.com/apache/incubator-mxnet/issues/12676
 
 
   ## Description
   Shapes given in the Value error seem to be mismatched between expected and got
   
   Python
   
   Compiler: visual studio
   
   MXNet commit hash: 769165b1794f9067e42c65477b3c2fe91a606f89
   
   ## Error Message:
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/Users/bapac/workspace/incubator-mxnet/python/mxnet/ndarray/utils.py", line 146, in array
       return _array(source_array, ctx=ctx, dtype=dtype)
     File "/Users/bapac/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 2489, in array
       arr[:] = source_array
     File "/Users/bapac/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 444, in __setitem__
       self._set_nd_basic_indexing(key, value)
     File "/Users/bapac/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 710, in _set_nd_basic_indexing
       self._sync_copyfrom(value)
     File "/Users/bapac/workspace/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 872, in _sync_copyfrom
       str(self.shape), str(source_array.shape)))
   ValueError: Shape inconsistent: expected () vs got (1,)
   
   
   ## Minimum reproducible example
   `mx.nd.array(1)`
   
   Correct way of initialization right now is to feed a list,
   ```
   >>> a=mx.nd.array([1])
   >>> a
   
   [1.]
   <NDArray 1 @cpu(0)>
   ```
   Shape of such an NDarray is 
   ```
   >>> a.shape
   (1,)
   ```
   
   Meaning, it expects (1,)
   However, when we feed ()
   It should give error 
   
   `ValueError: Shape inconsistent: expected (1,) vs got ()`
   

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