In this code, we set units = W.shape[1]. To my understanding,W.shape[1] represents the number of data samples (i.e., the number of items in row 1 of the W matrix) . Why can’t we do units = W.shape[0] instead? Wouldn’t W.shape[0] give the same number but also ensure that the first row exists since the second row (W[1]) might not always exist? Please let me know.
In the example on the left, you can see that W is 2 x 3, so W.shape[0] = 2, and W.shape[1] = 3. W.shape[0] is the number of items ini a_in, and W.shape[1] is the number of units in the layer.