TensorFlow 2.0 Beta is available Learn more

tf.keras.losses.cosine

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
  • 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
)
View source on GitHub