From the PDF file, I want to know what is wrong on the funtion of to compute cost? the function is :-
GRADED FUNCTION: compute_cost
def compute_cost(logits, labels):
cost=tf.reduce_mean(tf.keras.losses.categorical_crossentropy(y_true=labels,y_pred=logits))
YOUR CODE ENDS HERE
return cost
Welcome to our community !
I think you are very close. You need to add one more parameter for your “tf.keras.losses.categorical_crossentropy()”.
from_logits : Whether y_pred is expected to be a logits tensor. By default, we assume that y_pred encodes a probability distribution.
By the way, it is better not to attach any solution in here. Please remove PDF file. Thank you.
Noted with thanks,
How pdf file is deleted? I tried a couple of options but it was’nt deleted