Course 4, week 4, ex 3, J_style_layer_SG error

That is the value that you get if you just directly reshape the a_G and a_S to the final shape that you want. That is a mistake: you need to use transpose in addition to reshape in order to preserve the “channels” dimension. Please have another careful look at the instructions, including the “additional hint”.

For an example of why you can’t just directly reshape to the final shape, here’s a thread explaining a similar situation with reshaping images. It is critical to preserve the “samples” dimension in the image case: just doing the reshape without the transpose ends up scrambling the data. Here’s a better example that is directly relevant to this case here.

4 Likes