W4A2 Exercise 1 - compute_content_cost

Hi, I’m struggling on the compute_content_cost function, I just can’t seem to figure out what’s wrong.

I’m getting the following error:
AssertionError: Wrong value. Expected 7.0568767, current1354.92041015625

Could you give me a hint?

Lab ID: rnknmwcafqvp

Thank you,

For the content cost, there really aren’t that many “moving parts”. You don’t really have to do the unrolling that they talk about. Just subtract the two tensors, do the elementwise square, add all the results then multiply by that constant.

Maybe one issue could be mixing integer and float types. Here’s a thread which discusses that.

Note that no-one can directly look at your notebook other than the course staff and they generally are too busy to be listening here.

Thanks, I had simply missed the constant altogether.

1 Like