szha commented on issue #20898:
URL: 
https://github.com/apache/incubator-mxnet/issues/20898#issuecomment-1046412771


   In general we want to conform to the array API standard. While fp16 is not 
in the array standard yet, I tried the same with ints and the same discrepancy 
exists.
   
   ```
   In [17]: onp.array(-2, dtype=onp.int64) + onp.array([2, 0], dtype=onp.int16)
   Out[17]: array([ 0, -2], dtype=int16)
   
   In [18]: onp.array([-2], dtype=onp.int64) + onp.array([2, 0], 
dtype=onp.int16)
   Out[18]: array([ 0, -2])
   
   In [19]: np.array(-2, dtype=onp.int64) + np.array([2, 0], dtype=onp.int16)
   Out[19]: array([ 0, -2], dtype=int64)
   
   In [20]: np.array([-2], dtype=onp.int64) + np.array([2, 0], dtype=onp.int16)
   Out[20]: array([ 0, -2], dtype=int64)
   ```
   
   According to the [type promotion 
rules](https://data-apis.org/array-api/latest/API_specification/type_promotion.html)
 in array API standard, mxnet's current behavior is desired.
   
   > Type promotion rules must apply when determining the common result type 
for two array operands during an arithmetic operation, regardless of array 
dimension. Accordingly, zero-dimensional arrays must be subject to the same 
type promotion rules as dimensional arrays.
   
   @rgommers do you expect this to become a problem for API standard adoption 
on the numpy side?


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

To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@mxnet.apache.org
For additional commands, e-mail: issues-h...@mxnet.apache.org

Reply via email to