SciSharp / NumSharp

High Performance Computation for N-D Tensors in .NET, similar API to NumPy.
https://github.com/SciSharp
Apache License 2.0
1.38k stars 192 forks source link

np.roll - Index was outside the bounds of the array #429

Closed ChengYen-Tang closed 2 years ago

ChengYen-Tang commented 4 years ago

I get the following message when using np.roll. Index was outside the bounds of the array

var a = np.arange(10);
a.roll(5, 1);
Console.WriteLine(a.ToString());
OJacot-Descombes commented 3 years ago

Isn't the first axis numbered as 0, i.e., a.roll(5, 0)?

But in despite of this, I get the same exception with an array of shape (100, 400, 9): a = a[":", ":", 0].roll(1, 0) I tried different parameters. I always get an exception. I also don't find a unit test for roll.

ChengYen-Tang commented 3 years ago

@OJacot-Descombes ,

Ignore 😥 https://github.com/SciSharp/NumSharp/blob/00d8700b00e815f321238536e0d6b4dbc9af8d6a/test/NumSharp.UnitTest/Creation/NdArray.Roll.Test.cs

ChengYen-Tang commented 2 years ago

@OJacot-Descombes I found a more complete package, maybe you can try it. https://github.com/Quansight-Labs/numpy.net