C2_W1_Assignment: Error in UNO_C2 exercise

  • Link to the classroom : /notebooks/C2_W1_Assignment.ipynb at Coursera
  • Following the instructions of NumPy Model Implementation (Forward Prop in NumPy, I create a function definition to apply np.dot to my_dense function. Regardless double check the hints which matches with what I did I don´t have the expected results of: [0.54735762 0.57932425 0.61063923] after executing the notebook step called “Quick Check”. Instead I obtained: [0.54735762 0. 0. ]

After that, once I executed the step to invoke test_c2(my_dense) I got this error, which I am stucked:
AssertionError Traceback (most recent call last)
in
1 # UNIT TESTS
2
----> 3 test_c2(my_dense)

~/work/public_tests.py in test_c2(target)
41 assert A_tst.shape[0] == len(b_tst)
42 assert np.allclose(A_tst, [10., 20.]),
—> 43 “Wrong output. Check the dot product”
44
45 b_tst = np.array([3., 5.]) # (2 features)

AssertionError: Wrong output. Check the dot product

Please any help or hint

You don’t need to create a new function. Just include the use of np.dot() inside the my_dense() function.

Hi @TMosh, thanks for your answer. Just to confirm, I already invoked the function np.dot() as shown below, and as I said all the time the issue was the same. Please take a look:

{mentor edit: code removed}

So, considering, that even though the function is called and I have the same issue, what would I am missing here?

What does **z = do? I’ve never seen that notation before.

hi @TMosh please ignore it. This notation came when I tried to make the text in Bold when I copied and paste my code here. Sorry for this misunderstanding.
Original code is this:

{mentor edit: code removed}

  1. Please don 't post your code on the forum. That’s not allowed by the Code of Conduct.

  2. Your return statement has the wrong indentation. Since it is inside the for-loop, it’s going to return after one iteration.

1 Like

Hi @TMosh that was my first post, I was not aware.
Thanks for warning me. By the way the indentation problem you told was the issue. I fix it and pass .
Thanks a lot for your help :grinning:

1 Like