I have done this function that uses ctypes to create an object with a buffer protocol that points to a specified address:
import numpy as np
def np_buffer_from_address(shape, dtype, address):
import ctypes
return np.ndarray(shape, dtype = dtype, buffer = ctypes.c_void_p.from_address(address))
But I wanted to know if I can do this without using ctypes. If you can do it directly with numpy
address? In the link I show that you can use the.dataattribute of another array. stackoverflow.com/a/39377877/901925numpy.ctypesmight help; docs.scipy.org/doc/numpy-1.13.0/reference/generated/…