C2_W4_Assignment(Cost function results not matching(2.4))

Unable to get correct result for 2.4 - Cost Function.
Forward function and softmax results were okay but cost function results were not as expected.

Well, notice that they gave you the compute_cost code. If you look at how they constructed that test case, the other piece of your code it depends on is the forward_prop function. Maybe that is incorrect. Did you check your output values on the previous test for forward_prop?

Update: oh, sorry, I didn’t check what you posted carefully enough the first time. That’s what you showed. So it’s more of a mystery. But if all your code is correct and they gave you the compute_cost code, the only way it could be wrong is if you modified the compute_cost code. Maybe you should get a clean copy and carefully “copy/paste” over just your code and see if that fixes things.

Hi @Vishwam_Gupta

This is a bug (the “Expected output” cell is not correct) and it will be corrected soon.

Nice job for spotting it. Thanks!

1 Like

I was able to get the same expected output as shown there.

Hi @paulinpaloalto

Hmm… That is strange. Could you share your Notebook with me through DM? Maybe we have different versions.

Oh, sorry, it turns out I was stuck in an old version of the course because I enrolled a long time ago and hadn’t looked at it lately. I just switched and will have to rework everything. Stay tuned!

1 Like

Yes, I now see the same problem that Vishwam reported: the expected value does not match on the cost output. But several other problems with the earlier version of the notebook have been fixed. :nerd_face:

1 Like

As @arvyzukai told, it is a bug, so we can ignore it safetly.

1 Like

Also noticed this bug. Cost value in the Expected output seems to be calculated for tmp_batch_size = 1. With these value it equals 8.9542

1 Like