tf.contrib.losses.cosine_distance(predictions, targets, dim, weight=1.0, scope=None)
Adds a cosine-distance loss to the training procedure.
Note that the function assumes that the predictions and targets are already unit-normalized.
Args:
-
predictions
: An arbitrary matrix. -
targets
: ATensor
whose shape matches 'predictions' -
dim
: The dimension along which the cosine distance is computed. -
weight
: Coefficients for the loss a scalar, a tensor of shape [batch_size] or a tensor whose shape matchespredictions
. -
scope
: The scope for the operations performed in computing the loss.
Returns:
A scalar Tensor
representing the loss value.
Raises:
-
ValueError
: If predictions.shape doesn't match targets.shape, if the ignore mask is provided and its shape doesn't match targets.shape or if the ignore mask is not boolean valued.
Please login to continue.