Week 2 Logistic_Regression_with_a_Neural_Network_mindset Assertion error

I keep getting error and I can’t figure it out.My deadline is in a few hours!

Error


AssertionError                            Traceback (most recent call last)
<ipython-input-14-a16910aa3a0e> in <module>
     10 assert type(grads["dw"]) == np.ndarray
     11 assert grads["dw"].shape == (2, 1)
---> 12 assert type(grads["db"]) == np.float64
     13 
     14 

I have tried everything and even converted db=0.0


{edited by mentor}

AssertionError                            Traceback (most recent call last)
<ipython-input-14-a16910aa3a0e> in <module>
     10 assert type(grads["dw"]) == np.ndarray
     11 assert grads["dw"].shape == (2, 1)
---> 12 assert type(grads["db"]) == np.float64
     13 
     14 

I have tried everything and even converted db=0.0

Hello, @sanjeev.v,

I suggest you to first add print(type(db)) like below to find out what it is. As you know, it should be a float, and we also know that we are aggregating some numpy arrays into db, so we should set the aggregation function correctly to get it return a float scalar instead of any array.

    ### BEGIN SOLUTION
    dw = ...
    db = ...
    print('The type of db is: ', type(db)))
    ### END SOLUTION

Cheers,
Raymond

PS: we couldn’t share assignment work here, but please don’t worry as I will remove them for you. Also, posting in the right forum helps your mentors and fellow learners to find your post, so please post it to the right category under Deep Learning Specialization next time.

It worked thank you