I can’t figure out how to use built-in python functions from mojo. Specifically, i want to wrap a numpy array around a mojo HostDevice, and i need the python memoryview() function for that. How to call it? Python.memoryview() doesn’t work…
I tried an alternative way of wrapping using ctypes and numpy.ndarray() but it crashes. No built-in python functions were needed there.
If anyone had managed to wrap a mojo (unsafe) pointer to memory into a numpy array, please share your code.
Indeed, it works. Thanks!
Mentioning this in an article about python interop would be helpful. For instance Python integration | Modular should be a good place.