Hello ibeaty,
- For linear function grader cell,
please do the correction in code according to the below instruction which is given in your notebook before the grader cell
Note that the difference between tf.constant
and tf.Variable
is that you can modify the state of a tf.Variable
but cannot change the state of a tf.constant
.
You do not need to use tf. constant to your code.
-
In your one hot matrix, you do not require axis =0 as you by calling this the new axis would be created at 0 dimension.
In the same one hot matrix grader cell, you are going to create a single-column matrix, then why have you tuple that with indentation error? -
In this grader cell when the initialiser is already recalled by
initializer = tf.keras.initializers.GlorotNormal(seed=1)
then why are you again recalling your parameters with tf.keras.initializers.GlorotNormal(seed=1) in every parameter?
GRADED FUNCTION: initialize_parameters
for activation you need to use tf.nn.relu instead of tf.keras.activation.relu
5.# GRADED FUNCTION: compute_total_loss
#(1 line of code)
# remember to set from_logits=True
# total_loss = …
your grader cell clearly mentions your total loss is single code line as explain by @TMosh with the instructions given in his previous comments which is from the same notebook you are doing.
You need to recall your total loss based on the below instructions
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.- You skipped applying “softmax” in
Exercise 5
which will now be taken care by thetf.keras.losses.categorical_crossentropy
by setting its parameterfrom_logits=True
(You can read the response by one of our mentors here in the Community for the mathematical reasoning behind it. If you are not part of the Community already, you can do so by going here.)
You probably got confused with the batch of samples to recall it separately.
Please do these corrections!!!
Regards
DP