Week 2 Exercise 5 - propagate

I’m getting the following Assertion:

when try to debug it in the PyCharm Console i’m getting the following Values

Could you help please to understand what is wrong here?
it looks like the values are correct and it is something else

Thanks ,

Hey @Sahar_Bello,
From your debugging in the PyCharm console and from your assertion error, it can be seen that the error resides with the type of grads[db], which basically stores your db variable. It is supposed to be a single float value, but your code returns it as a (1, 1) dimensional 2D array. I guess you haven’t used the sum function while calculating db, and simply taken the difference between the arrays A and Y. I hope this helps.


Acctually i used
np.sum(Formula , axis=1) and it led to ndarray type
when i deleted the axis=1 and wrote
np.sum(Formula) it turned to float64 type
do you have any idea why?


Hey @Sahar_Bello,
In order to find the answer to your query, we don’t need to go any further than the official documentation of the numpy sum function. I have also attached the screenshot of the relevant thing below for your reference.

Screenshot from 2022-05-04 18-24-57

If a is a 0-d array, or if axis is None, a scalar is returned. I hope this helps.