minpy icon indicating copy to clipboard operation
minpy copied to clipboard

np.log: ValueError 'Too many positional arguments' for scalar inputs

Open wellecks opened this issue 8 years ago • 1 comments

Hi, please see the script below; log throws an error when a scalar is provided as input (this may also occur for other operations like abs). Using a singleton array works as a workaround, but I wanted to check whether the error is desired behavior?

import minpy.numpy as mp
import numpy as np

# works
np.log(2)

# works
mp.log(mp.array([2]))

# ValueError
mp.log(2)

wellecks avatar Jan 23 '17 19:01 wellecks

Sorry, this problem is caused by the difference between MXNet API and NumPy API, as you can see, in MXNet, the code below cannot work well too:

import mxnet.ndarray as nd

# works
nd.log(nd.array([2]))

# error
nd.log(2)

This problem should be fixed in the near future.

ZihengJiang avatar Jan 25 '17 13:01 ZihengJiang