Created
December 31, 2019 11:39
-
-
Save SuvroBaner/b2476a39cc97c8f1195e12be97cd72f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compute_cost(Z3, Y): | |
""" | |
Arguments: | |
Z3 -- output of forward propagation (output of the last LINEAR unit), of shape (6, number of examples) | |
Y -- "true" labels vector placeholder, same shape as Z3 | |
Returns: | |
cost - Tensor of the cost function | |
""" | |
logits = tf.transpose(Z3) | |
labels = tf.transpose(Y) | |
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits = logits, labels = labels)) | |
return cost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment