This commit is contained in:
nickwalton
2019-10-22 18:48:12 -06:00
parent cba5bd1827
commit 7bad170add
+3 -1
View File
@@ -133,7 +133,9 @@ model = tf.keras.Model(inputs=tokens, outputs=logits)
# the loss function is a simple categorical crossentropy between the logits and the labels
def loss(labels, logits):
return tf.keras.losses.sparse_categorical_crossentropy(labels, logits, from_logits=True)
loss = tf.keras.losses.sparse_categorical_crossentropy(labels, logits, from_logits=True)
loss = tf.Print(loss, [loss])
return loss
# the optimizer is not used since this code only supports inference