dmlc / minpy

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

Uniform sampler failed #159

Open wddabc opened 7 years ago

wddabc commented 7 years ago

Mentioned in #158, but should be a separate issue: The sample code

import minpy
print minpy.numpy.random.uniform(low=-1., high=1., size=(2,3))

triggered

mxnet/python/mxnet/base.pyc in check_call(ret) 73 """ 74 if ret != 0: ---> 75 raise MXNetError(py_str(_LIB.MXGetLastError())) 76 77 if sys.version_info[0] < 3:

MXNetError: Cannot find argument 'size', Possible Arguments:

low : float, optional, default=0 The lower bound of distribution high : float, optional, default=1 The upper bound of distribution shape : Shape(tuple), optional, default=() The shape of the output ctx : string, optional, default='' Context of output, in format cpu|gpu|cpu_pinned.Only used for imperative calls. dtype : int, optional, default='0' DType of the output , in operator uniform(name="", size="(2, 3)", low="-1.0", high="1.0")

jermainewang commented 7 years ago

This is an mxnet error. It uses shape rather than size argument. Try:

minpy.numpy.random.uniform(low=-1, high=1, shape=(2,3))
wddabc commented 7 years ago

Thanks. It works. But I think this issue should be remained open until it comforms to numpy.