update_loss_printing

This commit is contained in:
nickwalton
2019-10-23 14:45:12 -06:00
parent be7248018f
commit a5e8a2b518
+2 -2
View File
@@ -134,8 +134,8 @@ 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):
loss = tf.keras.losses.sparse_categorical_crossentropy(labels, logits, from_logits=True)
sum = tf.math.reduce_sum(loss)
loss = tf.Print(loss, [sum])
mean = tf.math.reduce_mean(loss)
loss = tf.Print(loss, [mean])
return loss