tf.compat.v1.losses.cosine_distance

View source on GitHub

Adds a cosine-distance loss to the training procedure. (deprecated arguments)

tf.compat.v1.losses.cosine_distance(
    labels, predictions, axis=None, weights=1.0, scope=None,
    loss_collection=tf.GraphKeys.LOSSES, reduction=Reduction.SUM_BY_NONZERO_WEIGHTS,
    dim=None
)

Warning: SOME ARGUMENTS ARE DEPRECATED: (dim). They will be removed in a future version. Instructions for updating: dim is deprecated, use axis instead

Note that the function assumes that predictions and labels are already unit-normalized.

Args:

Returns:

Weighted loss float Tensor. If reduction is NONE, this has the same shape as labels; otherwise, it is scalar.

Raises:

Eager Compatibility

The loss_collection argument is ignored when executing eagerly. Consider holding on to the return value or collecting losses via a tf.keras.Model.