szhengac opened a new issue #16910: Scalar ndarray does not support 
exponentiation
URL: https://github.com/apache/incubator-mxnet/issues/16910
 
 
   ## Description
   the following codes produce error:
   
   ```
   a = mx.nd.array(2)
   b = 2**a
   ```
   or
   
   ```
   a = mx.nd.array(2)
   b = a**2
   ```
   
   ### Error Message
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/ndarray/ndarray.py", 
line 376, in __rpow__
       return power(other, self)
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/ndarray/ndarray.py", 
line 3824, in power
       _internal._rpower_scalar)
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/ndarray/ndarray.py", 
line 3457, in _ufunc_helper
       return rfn_scalar(rhs, float(lhs))
     File "<string>", line 32, in _rpower_scalar
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/_ctypes/ndarray.py", 
line 107, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File "/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/base.py", line 
255, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [07:30:49] src/imperative/./imperative_utils.h:146: 
Operator _rpower_scalar inferring shapes failed.
   input shapes:
   None
   output shapes:
   None
   operator attributes:
   scalar : 2.0
   
   Stack trace:
     [bt] (0) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(+0x6a6deb) 
[0x7fb6c0eaadeb]
     [bt] (1) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(mxnet::imperative::SetShapeType(mxnet::Context
 const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, mxnet::DispatchMode*)+0x363b) 
[0x7fb6c40ac18b]
     [bt] (2) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(mxnet::Imperative::Invoke(mxnet::Context
 const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&)+0x1db) [0x7fb6c40b2dfb]
     [bt] (3) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(+0x376deff) 
[0x7fb6c3f71eff]
     [bt] (4) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(MXImperativeInvokeEx+0x62)
 [0x7fb6c3f724c2]
     [bt] (5) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c)
 [0x7fb70cd71e20]
     [bt] (6) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x2eb)
 [0x7fb70cd7188b]
     [bt] (7) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x49a)
 [0x7fb70cd6c01a]
     [bt] (8) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x9fcb) 
[0x7fb70cd5ffcb]
   
   
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/ndarray/ndarray.py", 
line 372, in __pow__
       return power(self, other)
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/ndarray/ndarray.py", 
line 3824, in power
       _internal._rpower_scalar)
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/ndarray/ndarray.py", 
line 3459, in _ufunc_helper
       return lfn_scalar(lhs, float(rhs))
     File "<string>", line 32, in _power_scalar
     File 
"/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/_ctypes/ndarray.py", 
line 107, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File "/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/base.py", line 
255, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [07:31:22] src/imperative/./imperative_utils.h:146: 
Operator _power_scalar inferring shapes failed.
   input shapes:
   None
   output shapes:
   None
   operator attributes:
   scalar : 2.0
   
   Stack trace:
     [bt] (0) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(+0x6a6deb) 
[0x7fb6c0eaadeb]
     [bt] (1) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(mxnet::imperative::SetShapeType(mxnet::Context
 const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, mxnet::DispatchMode*)+0x363b) 
[0x7fb6c40ac18b]
     [bt] (2) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(mxnet::Imperative::Invoke(mxnet::Context
 const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, 
std::allocator<mxnet::NDArray*> > const&)+0x1db) [0x7fb6c40b2dfb]
     [bt] (3) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(+0x376deff) 
[0x7fb6c3f71eff]
     [bt] (4) 
/home/ubuntu/.local/lib/python3.5/site-packages/mxnet/libmxnet.so(MXImperativeInvokeEx+0x62)
 [0x7fb6c3f724c2]
     [bt] (5) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c)
 [0x7fb70cd71e20]
     [bt] (6) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x2eb)
 [0x7fb70cd7188b]
     [bt] (7) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x49a)
 [0x7fb70cd6c01a]
     [bt] (8) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x9fcb) 
[0x7fb70cd5ffcb]
   

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