I would like to check if two ndarrays are overlapping views of the same underlying ndarray.
To check that two slices are exactly the same, I can do something like:>
numpy.may_share_memory() is the best heuristic that we have at the moment. It is conservatively heuristic; it may give you false positives, but it will not give you false negatives. I think there might be ways to improve the heuristic to be 100% correct. If they pan out, they will be folded into that function, so that's the best way forward.