Forward prop implementation in python, can't understand np.dot(w,a_in)

w1 is a 2x1 array, a_in is a 1x2 array. Shouldn’t the multiplication give us a 2x2 array instead of a 1x1 array as shown in the lecture. What am is missing here? Also, why is w1 a 2x1 array instead of a 1x2 array and why are they stacked column-wise?

Hey there,

If you multiply W_1.a_{in} you will get 2x2 but if you multiply a_{in}.W_1 you will get 1x1. Also, stacking the weights can differ from an implementation to other implementation.

Hope this helps! Feel free to ask if you need further help :raised_hands:

1 Like

Thank you so much, but shouldn’t it have been np.dot(a_in, w) in that case instead of np.dot(w, a_in)?

It depends on the shapes of w and a_in.

2 Likes

@Alireza_Saei @TMosh Thank you so much, watching the optional lectures on vectorization helped clear my doubts.

Happy to help :raised_hands: