C2M1_Assignment_Unittest4_failing

Hello All, not sure if someone already faced this problem, at least I have seen other issues reported regarding

Course 2 –> Module 1 –> Last Assignment

The code in my notebook runs fine, also the last function called “get_trainable_params“.

And the output is as expected:

Total trainable parameters: 155266

If I now run the unittest at the end I receive any error:

And of course the grading fails as well.

I am not able to finish the Module .

Any help would be appriciated.#Thanks

If you pass one test (getting the correct number of trainable parameters) but fail a different test, the type of error to look for is non-general code. E.g. you may be hard-coding some assumptions about the input parameters or referencing global variables from the body of your function.

If that suggestion doesn’t shed any light, then another way to investigate would be to look at the unittest code and see what it is doing differently than the test in the notebook. Perhaps that would give you a more concrete clue about the type of error to be looking for. The unittests are in a separate file, which you can view by opening the file unittests.py that you can see in the “File Explorer” view of the assignment.

With what @paulinpaloalto mentioned as the first checkpoint, chances are your codes must not run down properly even if your codes might be correct (depending on your earlier unittest results and other variable recall conflicts)

Here is what I do @Christoph_Grund

Clear out kernel output, re-run codes again individually from beginning till the unitteest it didn’t pass earlier with the confidence that your codes are correct, you can also try this approach as sometimes kernels gets disconnected. The reason I am telling you try this is because of the unittest is mentioning your training of parameters didn’t complete, that means there could be some disconnect icity issues too.

Regards

Dr. Deepti

Hi @Christoph_Grund,

I have seen this error in Ex 4 of this assignment before, and if I’m not wrong, I know what is the matter here. This is on my radar to eleborate the failed test with more details.

I’m 99% sure that in your implementation you are not using .numel() method as expected (instead you might be using a different method). Take a look at the “Additional Code Hints” of this exercise.

Try it with .numel() and let me know how it goes.

Best,
Mubsi

1 Like

Thanks all for your feedback.

@Mubsi Special thanks to you, this was indead the issue.

I was using “nelements()”, which gave the same result, but caused the test to fail, which a none speaking error.

Thanks.

1 Like