I am getting an error when calculating my cost in exercise 5. I tried both dot product and multiply with sum but still not getting the correct answer. I am not sure what I am doing wrong.

Because the print statement gives the output Y which is used by the test case (it is different from the one you imported earlier).

Maybe you were using the global parameters, not the local ones. Or you were defining the logprobs outside of the compute_cost function. As I see in the screenshot you shared, you are getting the ValueError just after defining the logprobs. If you did this inside the compute_cost function, you get the error after running the test cell.

Hey! I tried your suggestion and it gives me this output
A2 shape: (1, 3)
Y shape: (1, 3)
A2 shape: (1, 3)
Y shape: (1, 3)
cost = 0.6926858869721941
A2 shape: (1, 5)
Y shape: (1, 5)
A2 shape: (5,)
Y shape: (1, 5)

with this assertion error
AssertionError Traceback (most recent call last)
in
3 print("cost = " + str(compute_cost(A2, t_Y)))
4
----> 5 compute_cost_test(compute_cost)