C2 W1 Assignement 2


All my test pass, but if I’m trying to run the two last cells, I get an error.

the two with error are : operands could not be broadcast together with shapes (20,211) (2,5)
and ValueError: shapes (2,3) and (2,93960) not aligned: 3 (dim 1) != 2 (dim 0)

[ValidateApp | INFO] Validating ‘/home/jovyan/work/submitted/courseraLearner/W1A2/Regularization.ipynb’
[ValidateApp | INFO] Executing notebook with kernel: python3
Tests failed on 1 cell(s)! These tests could be hidden. Please check your submission.

Hi @Boubacar_Diallo,

Firstly, you are asking a query regarding the Deep Learning Specialisation, but you have posted it in the AI for Medicine specialisation category.
Screenshot 2022-10-13 at 5.48.48 PM

I shall move it to the DLS category.

If you are new and not sure how to navigate around our Community, we have created this User Guide which you can take a look at.

As for your issue, the errors with the output Tests failed on 1 cell(s)! These tests could be hidden. Please check your submission. are a little tricky to deal with. Let me direct message you regarding this.


Thank you for your help Mubsi, I’ve sent you an email

Hi @Boubacar_Diallo,

Firstly, I apologise for the inconvenience that is where the autograder won’t tell you which exercise you have failed.

Anyways, I have investigated your notebook and your issue lies in Ex 3, all other exercises are correct.

In Ex 3, you are using hard coded values to set up the dimensions of the matrixes.

  • D1 = np.random.rand(2, 5), and
  • D2 = np.random.rand(3, 5)

The issue with setting up with hard coded values is that your code is no longer flexible, and while it passes the uni tests within the assignment, but it will fail the autograder, as the autograder tests are different (they set up these matrixes with different values of rows and columns).

You need to set up the values of D1 and D2 using the activation layer values of A1 and A2 respectively, by extracting their shape values.

Hope this helps,

1 Like