C1_W2_Linear_Regression submission error

Hi,

I run the code below without any issues in the notebook. When I submit it - i am getting an error: "Code Cell UNQ_C2: Function ‘compute_gradient’ is incorrect. Check implementation. "

Hello @bskorodumov, welcome to this community!

It is required that the function produces two scalars:

"""
      dj_dw (scalar): The gradient of the cost w.r.t. the parameters w
      dj_db (scalar): The gradient of the cost w.r.t. the parameter b 
"""

and you may want to check whether your function is doing exactly that, such as by

print(type(dj_dw))
print(type(dj_db))

Sometimes the public tests can’t catch all possible errors so you may find error messages like that at submission.

Good luck debugging, and cheers,
Raymond

PS: Posting assignment code isn’t allowed, so I removed it for you.

thank you @rmwkwok - i did not realized it - doing something like this dj_dw.item(), dj_db.item() solved the issue. i would suggest to enforce this kind of check in public_tests.py for catching this because it do not as of now ( and thus local test will pass) and it is likely other people may encounter similar issues in the future.