C1_W2_Linear Regression why my computed gradient is wrong?

I checked my code, seems the same as the hinted formula, could u help to see what’s wrong?

1 Like

Hi @shinesherry

Working with shapes and tensors can be confusing at first. Printing the shapes of intermediate variables can help you understand what’s happening and identify any mismatches or issues. Try to find the issue by checking your code carefully!

Hope it helps! If you feel stuck, feel free to send me your code in Private Messages!

1 Like

The assert is thrown by the value comparison, not the shape comparison.

The most common problem in computing dj_db is with indentation and which calculations are inside or outside of a for-loop.

Check your implementation very carefully.


Thank you so much! I checked and found that it’s the problem of indentation. :crazy_face:


Just remember these kinds of errors are thrown when our output doesn’t match with the test designed to check our output, so its better to check for the mathematical and syntax errors.
And welcome to this community. Cheers!