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 2017/11/21 23:44:54 UTC

[GitHub] reminisce commented on issue #8668: Precision error setting NDArray from np.float32 scalar

reminisce commented on issue #8668: Precision error setting NDArray from np.float32 scalar
URL: https://github.com/apache/incubator-mxnet/issues/8668#issuecomment-346197743
 
 
   When assigning a scalar value to an NDArray, the scalar is passed to the backend as a parameter, rather than an `NDArray`. This leads to converting the scalar to a python string and converting the python string to a `ctypes.c_char_p` in the frontend. After tracing the code, it's found that the scalar's last two digits were truncated when it reaches here: https://github.com/apache/incubator-mxnet/blob/master/src/c_api/c_api_ndarray.cc#L140
   
   while it was still good in the frontend before reaching here:
   https://github.com/apache/incubator-mxnet/blob/master/python/mxnet/_ctypes/ndarray.py#L83
   
   So it looks like a bug in `ctypes` converting floats to strings.
   
   @cjolivier01 is looking into this for more details.

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