Forward Propogation in NumPy Lecture Slide: units = W.shape[1] confusion

Hello,

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.

Thanks!

That’s not universally true. It’s up to the designer of the model how they want to arrange the dimensions.

Could you please elaborate on what the design of this model is, specifically?

@Sreeyutha_Ratala, it may be easiest to explain with the example from the video:

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.