np.argsort() throw IndexOutOfRangeException
rainyl opened this issue · 2 comments
rainyl commented
Description
When applying np.argsort() to a ndarray with dtype of np.Float32, the IndexOutOfRangeException will be thrown, with dtype=np.Float64, it worked as expected.
Minimum sample to reproduce
using NumpyDotNet;
namespace Test
{
public class TestClass
{
public static void Main()
{
var rng = new np.random();
var arr = rng.normal(4000, 1, new shape(3000, 2)).astype(np.Float32);
var x = arr.T[0, ":"] as ndarray;
var y = arr.T[1, ":"] as ndarray;
var idx = np.argsort(x);
}
}
}
and the error message:
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
at NumpyLib.CopyHelper`1.strided_byte_copy(Int64 dest_offset, Int64 src_offset, Int64 N)
at NumpyLib.numpyinternal._new_argsort(NpyArray op, Int32 axis, NPY_SORTKIND kind)
at NumpyLib.numpyinternal.NpyArray_ArgSort(NpyArray op, Int32 axis, NPY_SORTKIND kind)
at NumpyLib.numpyAPI.NpyArray_ArgSort(NpyArray op, Int32 axis, NPY_SORTKIND which)
at NumpyDotNet.NpyCoreApi.ArgSort(ndarray arr, Int32 axis, NPY_SORTKIND sortkind)
at NumpyDotNet.np.argsort(ndarray a, Nullable`1 axis, NPY_SORTKIND kind, IEnumerable`1 order)
at Test.TestClass.Main()
I am not familiar enough with this project for now, so, if there are something wrong with my sample, please fix me :-)
KevinBaselinesw commented
I just pushed a new version 0.9.83.7 that will fix this problem.
thank you!
rainyl commented
I just pushed a new version 0.9.83.7 that will fix this problem.
thank you!
Great! thanks for your works!