Course 4, Week 4, Assignment 2, Exercise 3

My code seems right, but I am getting below error. Please help to solve it!

Hey , could you share your notebook with me in a direct message ? I could then help you with it. Thanks.

There is no exercise 3 for assignment 2 of week 1 of course 4 …

You’re right.
The topic is corrected!

i have the same problem , J_style_layer_SG is 2.9203947 for my code . Did you solve it?

The solution is discussed on your other thread about this.

Not yet! I tried several ways but I cant solve it.

1 Like

I do according to hints and I read the mentioned solution. But I am getting “wrong value” error.
Is this code wrong?

a_S = tf.transpose(tf.reshape(a_S, shape=[n_H*n_W, n_C]))

That code looks correct to me. What value do you get from this print statement in the test block for that function:

print("J_style_layer = " + str(J_style_layer_SG))

Note that you may need to copy that line to be before the failing assertion.

This is the J value.
J_style_layer = tf.Tensor(24.920544, shape=(), dtype=float32)

Interesting. That’s a different answer from what @onur showed above. I don’t recognize that value as one of the common errors.

There is a lot of logic after the computation of the reshaped and transposed tensors. Are you sure you’ve carefully checked the actual formula for the style cost?

I send my code in a direct message. Could you check it?

Yes, I sent you an answer by DM. It is exactly what I asked you to do in my previous response: you needed to carefully check your code for the actual style formula.

Oh, you’re right. I don’t think I make mistake in that formula. Thank you for help!