how to get the memory address of a numpy array for C

后端 未结 2 755
慢半拍i
慢半拍i 2020-12-15 04:53

I constructed an numpy array::

a=np.ndarray([2,3]) 

then i want to see where its data are::

a.data 
>>>Out[213]: &         


        
2条回答
  •  佛祖请我去吃肉
    2020-12-15 05:37

    Also, have a look at ndarray.__array_interface__, which is a dict that contains all of the information you're after.

    In your case,

    pointer, read_only_flag = a.__array_interface__['data']
    

提交回复
热议问题