Weej 2 assiment

2023-10-26 (6)

def compute_gradient(x, y, w, b): 
    # moderator edit: code removed        
    return dj_dw, dj_db

I used this code but it didn’t work I keep getting an error that my implemition is wrong which is
AssertionError Traceback (most recent call last)
6 print(‘Gradient at initial w, b (zeros):’, tmp_dj_dw, tmp_dj_db)
----> 8 compute_gradient_test(compute_gradient)

~/work/public_tests.py in compute_gradient_test(target)
61 #assert dj_dw.shape == initial_w.shape, f"Wrong shape for dj_dw. {dj_dw} != {initial_w.shape}"
62 assert dj_db == -2, f"Case 2: dj_db is wrong: {dj_db} != -2"
—> 63 assert np.allclose(dj_dw, -10.0), f"Case 1: dj_dw is wrong: {dj_dw} != -10.0"
65 print(“\033[92mAll tests passed!”)

AssertionError: Case 1: dj_dw is wrong: -40.0 != -10.0

Hi, welcome to the forum.

You seem to be missing an ‘=’.

Also, in the future, please don’t post your code on the forum. That isn’t allowed by the course Code of Conduct.

You should only post an image of any error messages or asserts.

If a mentor needs to see your code, we’ll contact you with instructions.

It’s no problem, I’ll edit this thread to remove the code.