Hi,
As I work on assignment “Tensorflow introduction” of course 2:week 3, I am facing the following technical problem:

Exercises 5 and 6 do not run (no output) but exercises from 1 to 4 run well and provide outputs.

Every time I run exercise 5 with my answers, the notebook displays that the kernel is dead. I have been trying this so many times and even after a month it still says the same thing.

When I submit the assignment, it seems none of the answers get submitted

Assignment should only be submitted if it passed all the unit tests. It looks like ex5 and ex6 have crashed the kernel. If you send me a direct message with you code for ex5 and ex6, I will have a look for you.

Thanks, the recommended use of TF API worked for ex5. But for Ex6 I am still getting this error: "categorical_crossentropy() got an unexpected keyword argument ‘axis’ "

The implementation instruction for ex6 specified the loss function is tf.keras.losses.categorical_crossentropy(), the parameters required are different from the one you used below.

Implement the total loss function below. You will use it to compute the total loss of a batch of samples. With this convenient function, you can sum the losses across many batches, and divide the sum by the total number of samples to get the cost value.

It’s important to note that the “y_pred” and “y_true” inputs of tf.keras.losses.categorical_crossentropy are expected to be of shape (number of examples, num_classes).

tf.reduce_sum does the summation over the examples.