You can use the base attribute to check if an array shares the memory with another array:
>>> import numpy as np
>>> a = np.arange(27)
>>> b = a.reshape((3,3,3))
>>> b.base is a
True
>>> a.base is b
False
Not sure if that solves your problem. The base attribute will be None
if the array owns its own memory. Note that an array’s base will be another array, even if it is a subset:
>>> c = a[2:]
>>> c.base is a
True