Hi,
After some attempts and great tips from @mratsim on my previous thread "An Attempt to Access NumPy Array Data rom Nim" (Sorry for "rom -> from"), I created a repo
https://github.com/zaferarican/nimpy_numpy_examples
where I put two examples to access and modify numpy array data using nimpy ( thanks to @yglukhov ) and nim. These examples create two python modules so they can be called from python.
I hope it helps.
Please feel free to contribute. For some part of the examples, I could not figure out simpler ways.
I have updated the examples by adding a new example that uses arraymancer. In the example, I showed a way to copy numpy data to/from an arraymancer tensor.
As @mratsim said, in the future, arraymancer will support no-copy operators, and it will greatly improve bridging speed between numpy and arraymancer too.
Thanks to Vindaar for help on solving the issue on slow copy.
Finally, I had time to update
https://github.com/zaferarican/nimpy_numpy_examples
to update arraymancer example with zero-copy fromBuffer initialization. The performance increased significantly.
Thanks @mratsim for the update.