My assignment of course 2 week 3 , exercise 5 and 6 can't run neither whole assignment can't give grades for the exercises that were run

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

  1. Exercises 5 and 6 do not run (no output) but exercises from 1 to 4 run well and provide outputs.
  2. 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.
  3. When I submit the assignment, it seems none of the answers get submitted

How is this problem solved?

1 Like

Hi @Celestin_Nkundineza

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.

Hi @Celestin_Nkundineza ,

Your code for ex5 didn’t use the Tensorflow API. Here is the implementation instruction:

Exercise 5 - forward_propagation

Implement the forward_propagation function.

Note Use only the TF API.

  • tf.math.add
  • tf.linalg.matmul
  • tf.keras.activations.relu

After you made the changes in EX5, refresh the kernel and rerun the code from start to make sure the execution environment is clean. ex6 looks fine.

1 Like

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’ "

Hi @Celestin_Nkundineza ,

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.

tf.keras.metrics.categorical_crossentropy(    y_true, y_pred, from_logits=False, label_smoothing=0.0, axis=-1)

Exercise 6 - compute_total_loss

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.