I messed up some behavior of a function np.arraythat I don't understand. This code works as I expect:
arr1 = np.zeros((3,2))
arr2 = np.zeros((2,2))
np.array([arr1,arr2])
array([ array([[ 0., 0., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.]]),
array([[ 0., 0., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.],
[ 0., 0., 0.]])], dtype=object)
But this code gives me an error:
arr1 = np.zeros((2,3))
arr2 = np.zeros((2,2))
np.array([arr1,arr2])
ValueError: could not pass the input array from form (2,3) to form (2)
Why does it matter if the size of the first dimension matches? And how can I make a function behave like in the first example?