This question is very similar to the question I asked a while ago:
You can check the base attribute.
a = np.arange(50) b = a.reshape((5, 10)) print (b.base is a)
However, this is not ideal. You can also check if they are using memory with np.may_share_memory .
print (np.may_share_memory(a, b))
There is also a flags attribute that you can check:
print (b.flags['OWNDATA'])
But this last one seems a little suspicious to me, although I can’t say why ...
mgilson Jul 17 '12 at 14:30 2012-07-17 14:30
source share