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/12/21 00:49:19 UTC

[GitHub] sandeep-krishnamurthy opened a new issue #9159: Symbol.bind() do not warn or error on dtype mismatch between Symbol and binding Data

sandeep-krishnamurthy opened a new issue #9159: Symbol.bind() do not warn or error on dtype mismatch between Symbol and binding Data
URL: https://github.com/apache/incubator-mxnet/issues/9159
 
 
   ## Description
   Symbol bind() API do not warn or error out when user creates a Symbol with dtype="int32" and then passes "float32" data. Final result is "float32".
   
   Users who create a symbolic graph with "int32" and by mistake pass on float32 data are never warned. It silently converts everything to "float32".
   
   ## Environment info (Required)
   
   Latest MXNet pip install on Mac.
   
   ```
   In [16]: array1 = mx.nd.array([[1,2,3],[1,2,3]])
   
   In [17]: array2 = mx.nd.array([[1,1,1],[1,1,1]])
   
   In [18]: a = mx.sym.Variable('a', dtype='int32')
   
   In [19]: b = mx.sym.Variable('b', dtype='int32')
   
   In [20]: res1 = mx.sym.broadcast_plus(a, b)
   
   In [22]: array1.dtype
   Out[22]: numpy.float32
   
   In [23]: array2.dtype
   Out[23]: numpy.float32
   
   
   In [24]: executor2 = res1.bind(mx.cpu(), args={'a':array1, 'b':array2})
   
   In [25]: output2 = executor2.forward()
   
   In [26]: output2[0]
   Out[26]: 
   
   [[ 2.  3.  4.]
    [ 2.  3.  4.]]
   <NDArray 2x3 @cpu(0)>
   
   In [27]: output2[0].dtype
   Out[27]: numpy.float32
   
   
   ```

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