dmlc / minpy

NumPy interface with mixed backend execution
https://minpy.readthedocs.io/en/latest/
Other
1.11k stars 111 forks source link

minpy.numpy.sqrt() error #139

Open jacklxc opened 7 years ago

jacklxc commented 7 years ago

I was using OnlyNumpyPolicy in older version of minpy. After updating minpy, I could not use OnlyNumpyPolicy anymore. As a result, basic operations such as

import minpy.numpy as np
a = np.sqrt(2)

Causes errror:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/lixiangci/minpy/minpy/primitive.py", line 134, in __call__
    return self.call(args, kwargs)
  File "/Users/lixiangci/minpy/minpy/primitive.py", line 221, in call
    result_value = self._func(*arg_values, **kwarg_values)
  File "/Users/lixiangci/mxnet/python/mxnet/_ctypes/ndarray.py", line 104, in generic_ndarray_function
    raise ValueError("Too many positional arguments")
ValueError: Too many positional arguments

Personally I suggest developers to enable OnlyNumpyPolicy again to solve this problem.

Thank you.

jermainewang commented 7 years ago

This is because MXNet's sqrt call does not accept single scalar as argument. We will PR to MXNet to fix this problem.

wangg12 commented 7 years ago

@jermainewang Many functions in minpy don't accept scalar and list arguments, however numpy does. I think minpy should be consistent with that in numpy.

lryta commented 7 years ago

@wangg12 The fix is still on the way.