Course 4 Week 4 Assignment 2 Issue: Art generation with neural style transfer

I am implementing compute_layer_style_cost function in week 4 assignment 2, but it is returning error and I am not able to figure out why wrong value is coming.

Any help is appreciated ! Thanks

The most common error in that function has to do with the “reshape” operation that is required for a_S and a_G. Please note that you can’t just reshape directly to the final shape you want, because that scrambles the data. Here’s a thread which delves into that point and demonstrates why a transpose is required.

1 Like