【发布时间】:2012-06-29 15:41:48
【问题描述】:
我构造了一个 numpy 数组::
a=np.ndarray([2,3])
然后我想看看它的数据在哪里::
a.data
>>>Out[213]: <read-write buffer for 0x0482C1D0, size 48, offset 0 at 0x049E87A0>
a.data
>>>Out[214]: <read-write buffer for 0x0482C1D0, size 48, offset 0 at 0x049E82A0>
a.data
>>>Out[215]: <read-write buffer for 0x0482C1D0, size 48, offset 0 at 0x049E81C0>
...
为什么每次偏移地址都不一样? 如果我想使用 c_types 将数据传输到 c 函数::
ctypes_array = (ctypes.c_char * a.size * 8).from_address(ptr)
我应该如何获得ptr的值?
【问题讨论】: