Announcing the TensorFlow Dev Summit 2020 Learn more

tf.keras.losses.cosine

View source on GitHub

Computes the cosine similarity between labels and predictions.

Aliases:

tf.keras.losses.cosine(
    y_true,
    y_pred,
    axis=-1
)