W2_Ex-5_assert type(grads[“db”])_np.float64

Hi ! I cannot get rid of an error, indicating a type of a variable is wrong. When i print db, i get the correct answer and it is a float, but grads["db] puts it into an array and then the code doesn’t want to run because it tests on this : assert type(grads[“db”]) == np.float64

Please share full error.

Maybe you are getting float32 and it needs to be float64. But to fully understand this, as Saif mentioned, please share the full error.

More likely you used keepdims on the np.sum call and the problem is that db has type np.ndarray. I added print statements in my propagate code and here’s what I see:

type(db) = <class 'numpy.float64'>
type(dw) = <class 'numpy.ndarray'>
dw.shape = (2, 1)
dw = [[ 0.25071532]
db = -0.1250040450043965
cost = 0.15900537707692405
type(db) = <class 'numpy.float64'>
type(dw) = <class 'numpy.ndarray'>
dw.shape = (3, 1)
All tests passed!

it was the keepdims… thank you for your help !