wkcn edited a comment on issue #14361: [numpy] Add a global switch to turn 
on/off numpy compatibility
URL: https://github.com/apache/incubator-mxnet/pull/14361#issuecomment-473616124
 
 
   when set_numpy_comp(True) is called, the output of some reduction operators 
Is always a scalar, which break the construct of computational graph, and not 
benefit for deployment.
   
   I will write an example.
   ```python
   x = mx.nd.arange(6)
   x
   [0. 1. 2. 3. 4. 5.]
   <NDArray 6 @cpu(0)>
   x[1]
   [1.]
   <NDArray 1 @cpu(0)>
   
   # 1-dim NDArray
   mx.nd.sum(x)
   [15.]
   <NDArray 1 @cpu(0)>
   
   # 0-dim NDArray
   mx.numpy.sum(x)
   15.0
   <NDArray 1 @cpu(0)>
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to