Missed TensorFlow World? Check out the recap. Learn more

tf.keras.losses.cosine

View source on GitHub

Computes the cosine similarity between labels and predictions.

Aliases:

  • tf.compat.v1.keras.losses.cosine
  • tf.compat.v1.keras.losses.cosine_proximity
  • tf.compat.v1.keras.losses.cosine_similarity
  • tf.compat.v1.keras.metrics.cosine
  • tf.compat.v1.keras.metrics.cosine_proximity
  • tf.compat.v2.keras.losses.cosine_similarity
  • tf.compat.v2.losses.cosine_similarity
  • tf.keras.losses.cosine_proximity
  • tf.keras.losses.cosine_similarity
  • tf.keras.metrics.cosine
  • tf.keras.metrics.cosine_proximity
tf.keras.losses.cosine(
    y_true,
    y_pred,
    axis=-1
)