[Bug] np.random.choice raise Exception
QingtaoLi1 opened this issue · 6 comments
Hi, when using np.random.choice
, I got an Exception with message "Specified method is not supported.", and the stack trace is:
at NumSharp.NPTypeCodeExtensions.GetAccumulatingType(NPTypeCode typeCode)
at NumSharp.Backends.DefaultEngine.cumsum_elementwise(NDArray& arr, Nullable1 typeCode) at NumSharp.Backends.DefaultEngine.ReduceCumAdd(NDArray& arr, Nullable
1 axis_, Nullable1 typeCode) at NumSharp.np.cumsum(NDArray arr, Nullable
1 axis, Nullable`1 typeCode)
It seems there is no UT for this function in this repo.
Besides, another argument replace
is not used at all in both overrides.
I do a simple test on np.cumsum
since it is in the stack trace:
public static void RandomChoice() { var array = np.arange(1, 50265); var arrayDouble = 1.0 / array.astype(np.@double); var cumsum = np.cumsum(arrayDouble, typeCode: arrayDouble.typecode); // OK var cumsum2 = np.cumsum(arrayDouble); // raise Exception mentioned above }
It looks like there's something wrong in the default typeCode. BTW, I'm using the latest NumSharp 0.30.0 version.
相同的问题,你解决了吗?
目前发现的解决方案就是上面那样自己copy一个,加上typeCode就能跑了
是我没有留意到那个“Ok”的注释,按照你的方案,我复制了官方Numsharp-master中的相关方法,添加了相关的typeCode参数,问题解决。非常感谢!