Unable to get graded on C1_W1_Assignment Exercise 3 due to grader error

After using keras.mean and keras.log, I get 4 tests passed, 2 failed in exercise 3.

However, when I submit my assignment I get this grader error:

“Cell #UNQ_C3. Can’t compile the student’s code. Error: NotImplementedError(‘Cannot convert a symbolic Tensor (Const_1:0) to a numpy array.’,)”

which seems to be related to tensorflow v2/v1 compatibility issue.


Thank you,

Hi @Dr_Sumeet_Kumar,

Welcome to our community!

Before I give you the debug of your assignment, I’d like to point out a few things.

1 - Every assignment includes exercises. And for each exercise, there could be one or multiple unit tests to check the implementation. More unit tests for an exercise would mean it would check if your implementation is correct with different inputs and/or different aspects of your implementation.
2 - In order to “pass” your exercise, you need to “pass” all of the unit tests. Even if one unit test fails, you will not get a grade for your exercise.
3 - The autograder for the assignment runs from top to bottom. If it encounters an issue which would terminate its execution, you would not be given a partial or 0 grade. You encountered a runtime error, trying to perform an operation that is not supported, which is why you didn’t get the partial grade.
4 - Assignment and the autograder are two separate things (separate and different tests). Just because something worked in the assignment, doesn’t mean it would work in the autograder as well. This usually happens when learners try to hard-code their solution. Like in your case, the error you get in the assignment is about wrong output, but the autograder is giving a different error, because its execution is different.
5 - You are only expected to change the code in the assignment where you are asked, no where else. You should not also update or install any extra packages in the environment of the assignment, as it may work in the assignment, but might fail for the autograder.

Now, as for issue in your assignment, keeping (5) in mind, you had changed code. Particularly in the unit test cell of Ex 3. You started another keras session, which you are not supposed to.
And since you got an error in the assignment, the code didn’t run all the way through, which is why you got an error from the grader as well. Fix the code in the assignment and all should be good.


Hi Mubsi,

Thank you so much for the welcome to the community, the reminder of the dos and donts and the diagnosis of my mistake and showing the correct code.

I now see that by using tf.keras.backend.log and not the correct K.log , i was starting another session! Will remember this to avoid future pitfalls.

Thank you once again and wish you a beautiful day.