If you dont know the depth of your nestet array you can do it like this:
l = np.array([[[ 1, 2],[ 3, -4]], [-1, 0]])
from collections.abc import Iterable
def flatten(l):
returnlist=[]
for elem in l:
if isinstance(elem, Iterable):
returnlist.extend(flatten(elem))
else:
returnlist.append(elem)
return returnlist
np.array(flatten(l))
If its 2 dimensional you can go like that post suggest How to make a flat list out of list of lists:
flat_list = [item for sublist in l for item in sublist]
or just use numpys flatten.
By the way, your example is not two dimensional because of those double brackets, thats also why flatten() does not work:
np.array([
[[ 1, 2], [ 3, -4
]],[[-1, 0]]], dtype=object)