reminisce commented on issue #16910: Scalar ndarray does not support 
exponentiation
URL: 
https://github.com/apache/incubator-mxnet/issues/16910#issuecomment-558502561
 
 
   Please note that scalar tensors are only formally supported in `mxnet.numpy` 
module. Many operators in `mx.nd` do not have expected behaviors on scalar 
tensors. You will also need to turn on NumPy-compatible shape inference mode 
explicitly, because `shape=()` was treated as unknown shape information in the 
default mode for backward compatibility.
   ```python
   >>> from mxnet import np, npx
   >>> npx.set_np()  # turn on numpy-compatible shape inference mode
   >>> a = np.array(2)
   >>> 2 ** a
   array(4.)
   >>> a ** 2
   array(4.)
   
   >>> import mxnet as mx
   >>> a = mx.nd.array(2)
   >>> 2 ** a
   
   4.0
   <NDArray  @cpu(0)>
   >>> a ** 2
   
   4.0
   <NDArray  @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:
[email protected]


With regards,
Apache Git Services

Reply via email to