Shape of the weights for back propagation

Hello @Mahmad.Sharaf ,

The standard for the shape of the weights can be determined by you, and it will work AS LONG AS YOU KEEP IT CONSISTENT AND ADJUST THE FORMULAS TO YOUR CHOSEN SHAPE across your entire model.

You can define that W’s shape is {current_layer_units, previous_layer_units} or you can define that W’s shape is {previous_layer_units, current_layer_units}.

And moving forward, just make sure that the linear equation and all other formulas are consistent with your definition. For example, if you define that W’s shape = {previous_layer_units, current_layer_units}, the linear equation would be of the form z = W * X.T + b. Note that here I am transposing X.

In fact, if you decide to follow this specialization with the Deep Learning Specialization, you’ll notice how Prof. Ng uses a different shape in W than the one he uses in the Machine Learning Specialization you are taking.

Again: the key is to be consistent with your chosen shape.

You can see another response to this very same question HERE from one of our Super Mentors, @paulinpaloalto .

I hope this sheds light to your question.