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

cannot convert from 'NumSharp.NDArray' to 'System.Array' #463

Closed twister11211 closed 2 years ago

twister11211 commented 3 years ago

im trying to bring a custom AI model into C# I prepared the input the same way in python and it runs properly im able to prepare my input data the way i need it with num sharp but cant convert it into a System.Array that the model requires the fallowing is all that was required to make it run in python if any one could show me how to do that it would be a great help
int[]input = {57, 45, 46, 56, 11, 46}; var ip = np.asarray((0)).reshape((1)); ip.reshape((1, input.Length));

QingtaoLi1 commented 2 years ago

You can use npArray.Data<int>().ToArray() to convert from NDArray to int[].