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=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS,
dim=None
)
Note that the function assumes that predictions and labels are already
unit-normalized.
Returns | |
|---|---|
Weighted loss float Tensor. If reduction is NONE, this has the same
shape as labels; otherwise, it is scalar.
|
Raises | |
|---|---|
ValueError
|
If predictions shape doesn't match labels shape, or
axis, labels, predictions or weights is None.
|
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.
View source on GitHub