W4_A1_Ex-6_Compute Cost

HI, when I use this code in my exercise I don’t get the correct answer, but when I use the code from week 3 programming assignment to compute cost, I get the correct answer. Can somebody explain why?? Thank You

{Moderator’s Edit: Solution Code Removed]

Hey @Syed_Hamza_Tehseen,
In your code, you have taken the transpose of Y and (1 - Y). If say, the dimensionality of Y = (1, m), where m is the number of examples; then in your opinion, what will be the dimensionality of cost_1 and cost_2? Will that be (1, 1) or (m, m)? I hope this resolves your query.