Subject: Exercise 6 – Shape Mismatch Error During Grading

Hi,
I’m getting this error when grading Exercise 6:

Error message - operands could not be broadcast together with shapes (1,3) (1,5)

Exercises 1–5 work fine, and the full code runs perfectly in my own Jupyter Notebook. But when I submit for grading, the error shows up.

I suspect the autograder might be using an older Y with shape (1, 3) instead of (1, 5) during update_parameters().

Do I need to redefine Y before backprop and update steps? Any suggestions?

Thanks!

Hi @yoonsnow1992

The error is due to a mismatch in shapes during parameter updates—your gradients or activations have inconsistent dimensions with the expected shapes in the autograder. Ensure your implementation handles variable input sizes dynamically and uses shape-consistent matrix operations (e.g., avoid hardcoding dimensions). You can also print intermediate values for debugging.

Hope it helps! Feel free to ask if you need further assistance.

1 Like

@Alireza_Saei Thanks alot. It is working now. :slight_smile:

2 Likes

You’re welcome, happy to help :raised_hands: