When we initialize numpy arrays using np.zeros or np.ones, we may leave the last dimension unspecified.
The following are examples:
x1 = np.zeros((4, ))
x2 = np.zeros((4, 3, ))
But the following doesn't work
x3 = np.zeros(( , 4))
x4 = np.zeros(( 4, , ))
I'm not quite sure what the purpose of leaving the last dimension unspecified is. It seems like there is no difference between np.zeros((4, )
) and np.zeros((4))
, so I don't clearly understand the reason of leaving the last dimenion unspecified. Could anyone clarify on this?